Class StreamingListener
java.lang.Object
org.wso2.carbon.inbound.endpoint.protocol.nats.StreamingListener
- All Implemented Interfaces:
NatsMessageListener
Streaming listener class which uses NATS streaming connection to receive messages.
-
Constructor Summary
ConstructorsConstructorDescriptionStreamingListener(String subject, NatsInjectHandler injectHandler, Properties natsProperties) -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the connection to NATS Streaming server and set connection to null.booleanCreate the connection to the NATS Streaming server.voidinitializeConsumer(String sequenceName) Consume the message received and inject into the sequence.
-
Constructor Details
-
StreamingListener
public StreamingListener(String subject, NatsInjectHandler injectHandler, Properties natsProperties)
-
-
Method Details
-
createConnection
Create the connection to the NATS Streaming server.- Specified by:
createConnectionin interfaceNatsMessageListener- Returns:
- boolean value whether connection is created.
- Throws:
IOExceptionInterruptedException
-
initializeConsumer
public void initializeConsumer(String sequenceName) throws InterruptedException, IOException, TimeoutException Consume the message received and inject into the sequence.- Specified by:
initializeConsumerin interfaceNatsMessageListener- Parameters:
sequenceName- the sequence to inject the message to.- Throws:
InterruptedExceptionIOExceptionTimeoutException
-
closeConnection
public void closeConnection()Close the connection to NATS Streaming server and set connection to null.- Specified by:
closeConnectionin interfaceNatsMessageListener
-