Class StreamingListener
- java.lang.Object
-
- org.wso2.carbon.inbound.endpoint.protocol.nats.StreamingListener
-
- All Implemented Interfaces:
NatsMessageListener
public class StreamingListener extends Object implements NatsMessageListener
Streaming listener class which uses NATS streaming connection to receive messages.
-
-
Constructor Summary
Constructors Constructor Description StreamingListener(String subject, NatsInjectHandler injectHandler, Properties natsProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection()Close the connection to NATS Streaming server and set connection to null.booleancreateConnection()Create the connection to the NATS Streaming server.voidinitializeConsumer(String sequenceName)Consume the message received and inject into the sequence.
-
-
-
Constructor Detail
-
StreamingListener
public StreamingListener(String subject, NatsInjectHandler injectHandler, Properties natsProperties)
-
-
Method Detail
-
createConnection
public boolean createConnection() throws IOException, InterruptedExceptionCreate 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
-
-