public class StreamPubSubProvider extends AbstractPubSubProvider
Modifier and Type | Class and Description |
---|---|
class |
StreamPubSubProvider.Subscriber |
Modifier and Type | Field and 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 String |
logName |
protected static String |
NODE_ID_PROP |
protected static Random |
RANDOM |
protected Thread |
thread |
namespace, subscribers
Constructor and Description |
---|
StreamPubSubProvider() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Frees the resources.
|
protected String |
getNodeId() |
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() |
localPublish
public static final String GROUP_PREFIX
protected static final String NODE_ID_PROP
protected static final String LOG_CONFIG_OPT
protected static final String DEFAULT_LOG_CONFIG
protected static final String LOG_NAME_OPT
protected static final String CODEC_OPT
protected static final String DEFAULT_CODEC
protected LogAppender<Record> appender
public StreamPubSubProvider()
public void initialize(Map<String,String> options, Map<String,List<BiConsumer<String,byte[]>>> subscribers)
PubSubProvider
The options taken from the PubSubProviderDescriptor
The subscribers map structure is thread-safe. The implementation must not modify the subscribers map in any way.
initialize
in interface PubSubProvider
initialize
in class AbstractPubSubProvider
protected void startConsumerThread()
public void publish(String topic, byte[] message)
PubSubProvider
topic
- the topicmessage
- the messagepublic void close()
PubSubProvider
close
in interface PubSubProvider
close
in class AbstractPubSubProvider
Copyright © 2019 Nuxeo. All rights reserved.