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 void
closeConnection()
Close the connection to NATS Streaming server and set connection to null.boolean
createConnection()
Create the connection to the NATS Streaming server.void
initializeConsumer(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, InterruptedException
Create the connection to the NATS Streaming server.- Specified by:
createConnection
in interfaceNatsMessageListener
- Returns:
- boolean value whether connection is created.
- Throws:
IOException
InterruptedException
-
initializeConsumer
public void initializeConsumer(String sequenceName) throws InterruptedException, IOException, TimeoutException
Consume the message received and inject into the sequence.- Specified by:
initializeConsumer
in interfaceNatsMessageListener
- Parameters:
sequenceName
- the sequence to inject the message to.- Throws:
InterruptedException
IOException
TimeoutException
-
closeConnection
public void closeConnection()
Close the connection to NATS Streaming server and set connection to null.- Specified by:
closeConnection
in interfaceNatsMessageListener
-
-