Interface MessagingService

All Known Implementing Classes:
DefaultMessagingService

public interface MessagingService
  • Method Details

    • sendMessage

      void sendMessage(Message<?> message)
      Send a message with any class as a payload.
      Parameters:
      message - to send into the queue.
    • setupExchange

      void setupExchange(String exchange, com.rabbitmq.client.BuiltinExchangeType exchangeType) throws IOException
      Setup an exchange with a specific type and name.
      Parameters:
      exchange - The exchanges name
      exchangeType - The exchanges BuiltinExchangeType
      Throws:
      IOException - when an error is encountered during exchange setup.
    • bindQueueToExchange

      void bindQueueToExchange(String queue, String exchange) throws IOException
      Bind a queue to an existing exchange.

      If the given queue doesn't exist it will be created automatically.

      Parameters:
      queue - The queues name
      exchange - The exchanges name
      Throws:
      IOException - when an error is encountered during binding process.
    • bindQueueToExchange

      void bindQueueToExchange(String queue, String exchange, String routingKey) throws IOException
      Bind a queue to an exchange with a specific routing key.

      If the given queue doesn't exist it will be created automatically.

      Parameters:
      queue - The queues name
      exchange - The exchanges name
      routingKey - a exchange look at when deciding how to route the message.
      Throws:
      IOException - when an error is encountered during binding process.
    • startConsuming

      <T> void startConsuming(String queue, MessageCallback<T> messageCallback, Class<T> classOfCallback) throws IOException
      Start consuming messages from a queue.
      Type Parameters:
      T - is the type of the message.
      Parameters:
      queue - The queues name
      messageCallback - used for consuming the messages.
      classOfCallback - is the class of the messages that should be consumed.
      Throws:
      IOException - when an error is encountered during consumption.