public class PubSubServiceImpl extends DefaultComponent implements PubSubService
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_XP |
protected Map<String,String> |
options |
protected PubSubProvider |
provider
The currently-configured provider.
|
protected PubSubProviderDescriptor |
providerDescriptor
The descriptor for the currently-configured provider, or
null if it's the default. |
protected List<PubSubProviderDescriptor> |
providerDescriptors
All the registered descriptors.
|
protected Map<String,List<BiConsumer<String,byte[]>>> |
subscribers
List of subscribers for each topic.
|
lastModified| Constructor and Description |
|---|
PubSubServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
activate(ComponentContext context)
Activates the component.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
int |
getApplicationStartedOrder()
The component notification order for
Component.applicationStarted(org.nuxeo.runtime.model.ComponentContext). |
protected void |
providerDescriptorChanged() |
void |
publish(String topic,
byte[] message)
Publishes a message to the given topic.
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected void |
registerProvider(PubSubProviderDescriptor descriptor) |
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 |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected void |
unregisterProvider(PubSubProviderDescriptor descriptor) |
void |
unregisterSubscriber(String topic,
BiConsumer<String,byte[]> subscriber)
Unregisters a subscriber for the given topic.
|
getAdapter, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStartedpublic static final String CONFIG_XP
protected List<PubSubProviderDescriptor> providerDescriptors
protected PubSubProvider provider
protected PubSubProviderDescriptor providerDescriptor
null if it's the default.protected Map<String,List<BiConsumer<String,byte[]>>> subscribers
public PubSubServiceImpl()
public void activate(ComponentContext context)
ComponentThis method is called by the runtime when a component is activated.
activate in interface Componentactivate in class DefaultComponentcontext - the runtime contextpublic 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)
Componentstop in interface Componentstop in class DefaultComponentpublic 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 registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution in class DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentprotected void registerProvider(PubSubProviderDescriptor descriptor)
protected void unregisterProvider(PubSubProviderDescriptor descriptor)
protected void providerDescriptorChanged()
public 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 © 2018 Nuxeo. All rights reserved.