Class CoreListener
- java.lang.Object
-
- org.wso2.carbon.inbound.endpoint.protocol.nats.CoreListener
-
- All Implemented Interfaces:
NatsMessageListener
public class CoreListener extends Object implements NatsMessageListener
Core listener class which uses core NATS connection to receive messages.
-
-
Constructor Summary
Constructors Constructor Description CoreListener(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 server and set connection to null.boolean
createConnection()
Create the connection to the Core NATS server.io.nats.client.Connection
getNatsConnection()
Create and return the Core NATS connection.void
initializeConsumer(String sequenceName)
Consume the message received and inject into the sequence.
-
-
-
Constructor Detail
-
CoreListener
public CoreListener(String subject, NatsInjectHandler injectHandler, Properties natsProperties)
-
-
Method Detail
-
createConnection
public boolean createConnection() throws IOException, InterruptedException
Create the connection to the Core NATS server.- Specified by:
createConnection
in interfaceNatsMessageListener
- Returns:
- boolean value whether connection is created.
- Throws:
IOException
InterruptedException
-
getNatsConnection
public io.nats.client.Connection getNatsConnection() throws IOException, InterruptedException
Create and return the Core NATS connection.- Returns:
- the Core NATS connection.
- Throws:
IOException
InterruptedException
-
initializeConsumer
public void initializeConsumer(String sequenceName) throws IOException, InterruptedException
Consume the message received and inject into the sequence.- Specified by:
initializeConsumer
in interfaceNatsMessageListener
- Parameters:
sequenceName
- the sequence to inject the message to.- Throws:
IOException
InterruptedException
-
closeConnection
public void closeConnection()
Close the connection to NATS server and set connection to null.- Specified by:
closeConnection
in interfaceNatsMessageListener
-
-