Class PubsubBus

java.lang.Object
org.jenkinsci.plugins.pubsub.PubsubBus
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
GuavaPubsubBus

public abstract class PubsubBus extends Object implements ExtensionPoint
Abstract Pub-sub bus.
Author:
tom.fennelly@gmail.com
  • Constructor Details Link icon

    • PubsubBus Link icon

      public PubsubBus()
  • Method Details Link icon

    • getBus Link icon

      @NonNull public static PubsubBus getBus()
      Get the installed PubsubBus implementation.
      Returns:
      The installed PubsubBus implementation, or default implementation if none are found.
    • publish Link icon

      public void publish(@NonNull Message message) throws MessageException
      Publish a message on a channel.

      The message instance must have the channel and event name properties set on it.

      Parameters:
      message - The message properties.
      Throws:
      MessageException
    • publisher Link icon

      @NonNull protected abstract ChannelPublisher publisher(@NonNull String channelName)
      Get/create a new ChannelPublisher instance for the specified channel name.
      Parameters:
      channelName - The channel name.
      Returns:
      The ChannelPublisher instance.
    • subscribe Link icon

      @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, or null if 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 Link icon

      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, or null if 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 Link icon

      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 Link icon

      public abstract void shutdown()
      Shutdown the bus.
    • start Link icon

      public void start()
      will start the bus if it has been shutdown do not restart if already started