public class PubSubServiceImpl extends DefaultComponent implements PubSubService
| Modifier and Type | Field and Description | 
|---|---|
protected Map<String,String> | 
options  | 
protected PubSubProvider | 
provider
The currently-configured provider. 
 | 
protected Map<String,List<BiConsumer<String,byte[]>>> | 
subscribers
List of subscribers for each topic. 
 | 
static String | 
XP_CONFIG  | 
lastModified, name| Constructor and Description | 
|---|
PubSubServiceImpl()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
deactivate(ComponentContext context)
Deactivates the component. 
 | 
int | 
getApplicationStartedOrder()
The component notification order for  
Component.applicationStarted(org.nuxeo.runtime.model.ComponentContext). | 
void | 
publish(String topic,
       byte[] message)
Publishes a message to the given topic. 
 | 
void | 
registerSubscriber(String topic,
                  BiConsumer<String,byte[]> subscriber)
Registers a subscriber for the given topic. 
 | 
void | 
start(ComponentContext context)
Start the component. 
 | 
void | 
stop(ComponentContext context)
Stop the component. 
 | 
void | 
unregisterSubscriber(String topic,
                    BiConsumer<String,byte[]> subscriber)
Unregisters a subscriber for the given topic. 
 | 
activate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStartedpublic static final String XP_CONFIG
protected PubSubProvider provider
protected Map<String,List<BiConsumer<String,byte[]>>> subscribers
public PubSubServiceImpl()
public void deactivate(ComponentContext context)
ComponentThis method is called by the runtime when a component is deactivated.
deactivate in interface Componentdeactivate in class DefaultComponentcontext - the runtime contextpublic void start(ComponentContext context)
Componentstart in interface Componentstart in class DefaultComponentpublic void stop(ComponentContext context) throws InterruptedException
Componentstop in interface Componentstop in class DefaultComponentInterruptedExceptionpublic int getApplicationStartedOrder()
ComponentComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext).
 Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
getApplicationStartedOrder in interface Componentpublic void publish(String topic, byte[] message)
PubSubServicepublish in interface PubSubServicetopic - the topicmessage - the messagepublic void registerSubscriber(String topic, BiConsumer<String,byte[]> subscriber)
PubSubServiceThe subscriber must deal with the message without delay and return immediately, usually by storing it in a thread-safe datastructure.
registerSubscriber in interface PubSubServicetopic - the topicsubscriber - the subscriber, who will receive the topic and a byte[] messagepublic void unregisterSubscriber(String topic, BiConsumer<String,byte[]> subscriber)
PubSubServiceunregisterSubscriber in interface PubSubServicetopic - the topicsubscriber - the subscriberCopyright © 2019 Nuxeo. All rights reserved.