Package org.jenkinsci.plugins.pubsub
Class PubsubBus
java.lang.Object
org.jenkinsci.plugins.pubsub.PubsubBus
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
GuavaPubsubBus
Abstract Pub-sub bus.
- Author:
- tom.fennelly@gmail.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PubsubBusgetBus()Get the installedPubsubBusimplementation.voidPublish a message on a channel.protected abstract ChannelPublisherGet/create a newChannelPublisherinstance for the specified channel name.abstract voidshutdown()Shutdown the bus.voidstart()will start the bus if it has been shutdown do not restart if already startedvoidsubscribe(String channelName, ChannelSubscriber subscriber, Authentication authentication, EventFilter eventFilter) Deprecated.voidsubscribe2(String channelName, ChannelSubscriber subscriber, org.springframework.security.core.Authentication authentication, EventFilter eventFilter) Subscribe to events on the specified event channel.abstract voidunsubscribe(String channelName, ChannelSubscriber subscriber) Unsubscribe from events on the specified event channel.
-
Constructor Details
-
PubsubBus
public PubsubBus()
-
-
Method Details
-
getBus
Get the installedPubsubBusimplementation.- Returns:
- The installed
PubsubBusimplementation, or default implementation if none are found.
-
publish
Publish a message on a channel.The message instance must have the
channelandeventname properties set on it.- Parameters:
message- The message properties.- Throws:
MessageException
-
publisher
Get/create a newChannelPublisherinstance for the specified channel name.- Parameters:
channelName- The channel name.- Returns:
- The
ChannelPublisherinstance.
-
subscribe
@Deprecated public void subscribe(@NonNull String channelName, @NonNull ChannelSubscriber subscriber, @NonNull Authentication authentication, @CheckForNull EventFilter eventFilter) Deprecated.Subscribe to events on the specified event channel.- Parameters:
channelName- The channel name.subscriber- The subscriber instance that will receive the events.authentication- The authentication to which the subscription is associated.eventFilter- A message filter, ornullif no filtering is to be applied. This tells the bus to only forward messages that match the properties (names and values) specified in the filter.
-
subscribe2
public void subscribe2(@NonNull String channelName, @NonNull ChannelSubscriber subscriber, @NonNull org.springframework.security.core.Authentication authentication, @CheckForNull EventFilter eventFilter) Subscribe to events on the specified event channel.- Parameters:
channelName- The channel name.subscriber- The subscriber instance that will receive the events.authentication- The authentication to which the subscription is associated.eventFilter- A message filter, ornullif no filtering is to be applied. This tells the bus to only forward messages that match the properties (names and values) specified in the filter.
-
unsubscribe
public abstract void unsubscribe(@NonNull String channelName, @NonNull ChannelSubscriber subscriber) Unsubscribe from events on the specified event channel.- Parameters:
channelName- The channel name.subscriber- The subscriber instance that was used to receive events.
-
shutdown
public abstract void shutdown()Shutdown the bus. -
start
public void start()will start the bus if it has been shutdown do not restart if already started
-