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 classStreamPubSubProvider.Subscriber
-
Field Summary
Fields Modifier and Type Field Description protected LogAppender<Record>appenderprotected Codec<Record>codecprotected static StringCODEC_OPTprotected static StringDEFAULT_CODECprotected static StringDEFAULT_LOG_CONFIGstatic StringGROUP_PREFIXprotected static StringLOG_CONFIG_OPTprotected static StringLOG_NAME_OPTprotected StringlogConfigprotected NamelogNameprotected StringnodeIdprotected static RandomRANDOMprotected Threadthread-
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 voidclose()Frees the resources.voidinitialize(Map<String,String> options, Map<String,List<BiConsumer<String,byte[]>>> subscribers)Initializes the resources for this provider and registers the local subscribers map.voidpublish(String topic, byte[] message)Publishes a message to the given topic.protected voidstartConsumerThread()-
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:PubSubProviderInitializes the resources for this provider and registers the local subscribers map.The options taken from the
PubSubProviderDescriptorThe subscribers map structure is thread-safe. The implementation must not modify the subscribers map in any way.- Specified by:
initializein interfacePubSubProvider- Overrides:
initializein classAbstractPubSubProvider
-
startConsumerThread
protected void startConsumerThread()
-
publish
public void publish(String topic, byte[] message)
Description copied from interface:PubSubProviderPublishes a message to the given topic.- Parameters:
topic- the topicmessage- the message
-
close
public void close()
Description copied from interface:PubSubProviderFrees the resources.- Specified by:
closein interfacePubSubProvider- Overrides:
closein classAbstractPubSubProvider
-
-