@Test public void onMessageProcessed() { final Connector connector = createConnector(); safeAction( () -> connector.setState( ConnectorState.CONNECTING ) ); final TestSpyEventHandler handler = registerTestSpyEventHandler(); final MessageResponse response = new MessageResponse( 1, ChangeSetMessage.create( null, null, null, null, null ), null ); connector.onMessageProcessed( response ); handler.assertEventCount( 1 ); handler.assertNextEvent( MessageProcessedEvent.class, e -> assertEquals( e.getSchemaId(), connector.getSchema().getId() ) ); }
void onMessageProcessed( @Nonnull final MessageResponse response ) { if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.MessageProcessedEvent( schema.getId() ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new MessageProcessedEvent( getSchema().getId(), getSchema().getName(), response.toStatus() ) ); } }
Connector extends ReplicantService { void onMessageProcessed( @Nonnull final MessageResponse response ) { if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.MessageProcessedEvent( schema.getId() ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new MessageProcessedEvent( getSchema().getId(), getSchema().getName(), response.toStatus() ) ); } } }
Connector extends ReplicantService { void onMessageProcessed( @Nonnull final MessageResponse response ) { if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.MessageProcessedEvent( schema.getId() ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new MessageProcessedEvent( getSchema().getId(), getSchema().getName(), response.toStatus() ) ); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); }
Connector extends ReplicantService { void onMessageProcessed( @Nonnull final MessageResponse response ) { if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.MessageProcessedEvent( schema.getId() ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new MessageProcessedEvent( getSchema().getId(), getSchema().getName(), response.toStatus() ) ); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString(); }
Connector extends ReplicantService { void onMessageProcessed( @Nonnull final MessageResponse response ) { if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.MessageProcessedEvent( schema.getId() ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new MessageProcessedEvent( getSchema().getId(), getSchema().getName(), response.toStatus() ) ); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString();  }