Interface JmsClient.OperationSpec

Enclosing interface:
JmsClient

public static interface JmsClient.OperationSpec
Common JMS send and receive operations with various settings.
Since:
7.0
Author:
Juergen Hoeller, Brian Clozel
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<org.springframework.messaging.Message<?>>
    Receive a Message from the pre-bound destination.
    <T> Optional<T>
    receive(Class<T> targetClass)
    Receive a Message from the pre-bound destination, extracting and converting its payload.
    Optional<org.springframework.messaging.Message<?>>
    receive(String messageSelector)
    Receive a Message from the pre-bound destination.
    <T> Optional<T>
    receive(String messageSelector, Class<T> targetClass)
    Receive a Message from the pre-bound destination, extracting and converting its payload.
    void
    send(Object payload)
    Send a message with the given payload to the pre-bound destination.
    void
    send(Object payload, Map<String,Object> headers)
    Send a message with the given payload to the pre-bound destination.
    void
    send(org.springframework.messaging.Message<?> message)
    Send the given Message to the pre-bound destination.
    <T> Optional<T>
    sendAndReceive(Object request, Class<T> targetClass)
    Send a request message and receive the reply from the given destination.
    <T> Optional<T>
    sendAndReceive(Object request, Map<String,Object> headers, Class<T> targetClass)
    Send a request message and receive the reply from the given destination.
    Optional<org.springframework.messaging.Message<?>>
    sendAndReceive(org.springframework.messaging.Message<?> requestMessage)
    Send a request message and receive the reply from the given destination.
    withDeliveryDelay(long deliveryDelay)
    Apply the given delivery delay to any subsequent send operations.
    withDeliveryPersistent(boolean persistent)
    Set whether message delivery should be persistent or non-persistent.
    withPriority(int priority)
    Apply the given priority to any subsequent send operations.
    withReceiveTimeout(long receiveTimeout)
    Apply the given timeout to any subsequent receive operations.
    withTimeToLive(long timeToLive)
    Apply the given time-to-live to any subsequent send operations.
  • Method Details

    • withReceiveTimeout

      JmsClient.OperationSpec withReceiveTimeout(long receiveTimeout)
      Apply the given timeout to any subsequent receive operations.
      Parameters:
      receiveTimeout - the timeout in milliseconds
      See Also:
    • withDeliveryDelay

      JmsClient.OperationSpec withDeliveryDelay(long deliveryDelay)
      Apply the given delivery delay to any subsequent send operations.
      Parameters:
      deliveryDelay - the delay in milliseconds
      See Also:
    • withDeliveryPersistent

      JmsClient.OperationSpec withDeliveryPersistent(boolean persistent)
      Set whether message delivery should be persistent or non-persistent.
      Parameters:
      persistent - to choose between delivery mode "PERSISTENT" (true) or "NON_PERSISTENT" (false)
      See Also:
    • withPriority

      JmsClient.OperationSpec withPriority(int priority)
      Apply the given priority to any subsequent send operations.
      Parameters:
      priority - the priority value
      See Also:
    • withTimeToLive

      JmsClient.OperationSpec withTimeToLive(long timeToLive)
      Apply the given time-to-live to any subsequent send operations.
      Parameters:
      timeToLive - the message lifetime in milliseconds
      See Also:
    • send

      void send(org.springframework.messaging.Message<?> message) throws org.springframework.messaging.MessagingException
      Send the given Message to the pre-bound destination.
      Parameters:
      message - the spring-messaging Message to send
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • send

      void send(Object payload) throws org.springframework.messaging.MessagingException
      Send a message with the given payload to the pre-bound destination.
      Parameters:
      payload - the payload to convert into a Message
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • send

      void send(Object payload, Map<String,Object> headers) throws org.springframework.messaging.MessagingException
      Send a message with the given payload to the pre-bound destination.
      Parameters:
      payload - the payload to convert into a Message
      headers - the message headers to apply to the Message
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • receive

      Optional<org.springframework.messaging.Message<?>> receive() throws org.springframework.messaging.MessagingException
      Receive a Message from the pre-bound destination.
      Returns:
      the spring-messaging Message received, or Optional.empty() if none
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • receive

      <T> Optional<T> receive(Class<T> targetClass) throws org.springframework.messaging.MessagingException
      Receive a Message from the pre-bound destination, extracting and converting its payload.
      Parameters:
      targetClass - the class to convert the payload to
      Returns:
      the payload of the Message received, or Optional.empty() if none
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • receive

      Optional<org.springframework.messaging.Message<?>> receive(String messageSelector) throws org.springframework.messaging.MessagingException
      Receive a Message from the pre-bound destination.
      Parameters:
      messageSelector - the JMS message selector to apply
      Returns:
      the spring-messaging Message received, or Optional.empty() if none
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • receive

      <T> Optional<T> receive(String messageSelector, Class<T> targetClass) throws org.springframework.messaging.MessagingException
      Receive a Message from the pre-bound destination, extracting and converting its payload.
      Parameters:
      messageSelector - the JMS message selector to apply
      targetClass - the class to convert the payload to
      Returns:
      the payload of the Message received, or Optional.empty() if none
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • sendAndReceive

      Optional<org.springframework.messaging.Message<?>> sendAndReceive(org.springframework.messaging.Message<?> requestMessage) throws org.springframework.messaging.MessagingException
      Send a request message and receive the reply from the given destination.
      Parameters:
      requestMessage - the spring-messaging Message to send
      Returns:
      the spring-messaging Message received as a reply, or Optional.empty() if none
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • sendAndReceive

      <T> Optional<T> sendAndReceive(Object request, Class<T> targetClass) throws org.springframework.messaging.MessagingException
      Send a request message and receive the reply from the given destination.
      Parameters:
      request - the payload to convert into a request Message
      targetClass - the class to convert the reply's payload to
      Returns:
      the payload of the Message received as a reply, or Optional.empty() if none
      Throws:
      org.springframework.messaging.MessagingException
      See Also:
    • sendAndReceive

      <T> Optional<T> sendAndReceive(Object request, Map<String,Object> headers, Class<T> targetClass) throws org.springframework.messaging.MessagingException
      Send a request message and receive the reply from the given destination.
      Parameters:
      request - the payload to convert into a request Message
      headers - the message headers to apply to the request Message
      targetClass - the class to convert the reply's payload to
      Returns:
      the payload of the Message received as a reply, or Optional.empty() if none
      Throws:
      org.springframework.messaging.MessagingException
      See Also: