Class MockConnector

java.lang.Object
io.helidon.messaging.connectors.mock.MockConnector
All Implemented Interfaces:
ConnectorFactory, IncomingConnectorFactory, OutgoingConnectorFactory

@ApplicationScoped public class MockConnector extends Object implements IncomingConnectorFactory, OutgoingConnectorFactory
Helidon messaging mock connector for testing purposes. Mock connector for testing Helidon messaging without the need of connection to actual messaging broker.
  • Field Details

  • Constructor Details

    • MockConnector

      public MockConnector()
  • Method Details

    • getPublisherBuilder

      public PublisherBuilder<? extends Message<?>> getPublisherBuilder(Config config)
      Specified by:
      getPublisherBuilder in interface IncomingConnectorFactory
    • getSubscriberBuilder

      public SubscriberBuilder<? extends Message<?>,Void> getSubscriberBuilder(Config config)
      Specified by:
      getSubscriberBuilder in interface OutgoingConnectorFactory
    • incoming

      public <P> MockIncoming<P> incoming(String channelName, Class<P> type)
      Retrieve mocker for incoming channel. Incoming channel needs to be configured to use MockConnector with:
      
       @AddConfig(key = "mp.messaging.incoming.test-channel-incoming", value = MockConnector.CONNECTOR_NAME)
       
      Type Parameters:
      P - type of the payload
      Parameters:
      channelName - Channel name, for example test-channel-incoming
      type - Type of the payload
      Returns:
      mocker for desired chanel
    • outgoing

      public <P> MockOutgoing<P> outgoing(String channelName, Class<P> type)
      Retrieve mocker for outgoing channel. Outgoing channel needs to be configured to use MockConnector with:
      
       @AddConfig(key = "mp.messaging.outgoing.test-channel-outgoing", value = MockConnector.CONNECTOR_NAME)
       
      Type Parameters:
      P - type of the payload
      Parameters:
      channelName - Channel name, for example test-channel-outgoing
      type - Type of the payload
      Returns:
      mocker for desired chanel