Interface Channel.Binding<T>

Type Parameters:
T -
Enclosing interface:
Channel<T>

public static interface Channel.Binding<T>
A destination for messages. This is a simple interface that allows the channel to deliver messages to a concrete destination.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the binding.
    void
    publish(T message)
    Delivers the message, blocking if necessary.
    boolean
    tryPublish(T message)
    Attempts to deliver the message immediately.
  • Method Details

    • tryPublish

      boolean tryPublish(T message)
      Attempts to deliver the message immediately. Must not block. If the message was delivered successfully, then returns true. Otherwise, returns false.
      Parameters:
      message - the message to publish
      Returns:
      true if the message was published, false otherwise
    • publish

      void publish(T message) throws InterruptedException
      Delivers the message, blocking if necessary. This method must not return until the message is delivered.
      Parameters:
      message - the message to publish
      Throws:
      InterruptedException - if the thread is interrupted while waiting
    • close

      void close()
      Closes the binding. No more messages will be delivered after this method is called. Any threads currently blocking while trying to publish a message will be interrupted. When this method returns, all blocking threads will have been interrupted, but not joined.