Package org.nuxeo.runtime.pubsub
Class StreamPubSubProvider
- java.lang.Object
-
- org.nuxeo.runtime.pubsub.AbstractPubSubProvider
-
- org.nuxeo.runtime.pubsub.StreamPubSubProvider
-
- All Implemented Interfaces:
PubSubProvider
public class StreamPubSubProvider extends AbstractPubSubProvider
A Pub/Sub provider based on Nuxeo Stream.- Since:
- 10.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StreamPubSubProvider.Subscriber
-
Field Summary
Fields Modifier and Type Field Description protected LogAppender<Record>
appender
protected Codec<Record>
codec
protected static String
CODEC_OPT
protected static String
DEFAULT_CODEC
protected static String
DEFAULT_LOG_CONFIG
static String
GROUP_PREFIX
protected static String
LOG_CONFIG_OPT
protected static String
LOG_NAME_OPT
protected String
logConfig
protected Name
logName
protected String
nodeId
protected static Random
RANDOM
protected Thread
thread
-
Fields inherited from class org.nuxeo.runtime.pubsub.AbstractPubSubProvider
namespace, subscribers
-
-
Constructor Summary
Constructors Constructor Description StreamPubSubProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Frees the resources.void
initialize(Map<String,String> options, Map<String,List<BiConsumer<String,byte[]>>> subscribers)
Initializes the resources for this provider and registers the local subscribers map.void
publish(String topic, byte[] message)
Publishes a message to the given topic.protected void
startConsumerThread()
-
Methods inherited from class org.nuxeo.runtime.pubsub.AbstractPubSubProvider
localPublish
-
-
-
-
Field Detail
-
GROUP_PREFIX
public static final String GROUP_PREFIX
- See Also:
- Constant Field Values
-
LOG_CONFIG_OPT
protected static final String LOG_CONFIG_OPT
- See Also:
- Constant Field Values
-
DEFAULT_LOG_CONFIG
protected static final String DEFAULT_LOG_CONFIG
- See Also:
- Constant Field Values
-
LOG_NAME_OPT
protected static final String LOG_NAME_OPT
- See Also:
- Constant Field Values
-
CODEC_OPT
protected static final String CODEC_OPT
- See Also:
- Constant Field Values
-
DEFAULT_CODEC
protected static final String DEFAULT_CODEC
- See Also:
- Constant Field Values
-
RANDOM
protected static final Random RANDOM
-
logConfig
protected String logConfig
-
logName
protected Name logName
-
appender
protected LogAppender<Record> appender
-
thread
protected Thread thread
-
nodeId
protected String nodeId
-
-
Method Detail
-
initialize
public void initialize(Map<String,String> options, Map<String,List<BiConsumer<String,byte[]>>> subscribers)
Description copied from interface:PubSubProvider
Initializes the resources for this provider and registers the local subscribers map.The options taken from the
PubSubProviderDescriptor
The subscribers map structure is thread-safe. The implementation must not modify the subscribers map in any way.- Specified by:
initialize
in interfacePubSubProvider
- Overrides:
initialize
in classAbstractPubSubProvider
-
startConsumerThread
protected void startConsumerThread()
-
publish
public void publish(String topic, byte[] message)
Description copied from interface:PubSubProvider
Publishes a message to the given topic.- Parameters:
topic
- the topicmessage
- the message
-
close
public void close()
Description copied from interface:PubSubProvider
Frees the resources.- Specified by:
close
in interfacePubSubProvider
- Overrides:
close
in classAbstractPubSubProvider
-
-