Class RequestReplyHandler

java.lang.Object
com.tnsai.protocols.handlers.AbstractProtocolHandler
com.tnsai.protocols.handlers.RequestReplyHandler
All Implemented Interfaces:
ProtocolHandler

public final class RequestReplyHandler extends AbstractProtocolHandler
Handler for synchronous request-reply messaging. Blocks until reply is received or timeout occurs.
  • Constructor Details

    • RequestReplyHandler

      public RequestReplyHandler(Transport transport, long timeoutMillis)
  • Method Details

    • send

      public com.tnsai.protocols.models.Message send(com.tnsai.protocols.models.Message message) throws ProtocolHandler.HandlerException
      Description copied from interface: ProtocolHandler
      Sends a message using this protocol.
      Parameters:
      message - Message to send
      Returns:
      Response message (null for async protocols)
      Throws:
      ProtocolHandler.HandlerException - if send fails
    • sendAsync

      public void sendAsync(com.tnsai.protocols.models.Message message, ProtocolHandler.HandlerCallback callback)
      Description copied from interface: ProtocolHandler
      Sends a message asynchronously.
      Parameters:
      message - Message to send
      callback - Callback for response
    • handleReply

      public void handleReply(com.tnsai.protocols.models.Message reply)
      Handles incoming reply message. Called by transport layer when reply is received.
      Parameters:
      reply - Reply message
    • getTimeoutMillis

      public long getTimeoutMillis()
      Gets the timeout in milliseconds.
      Returns:
      Timeout value
    • getPendingCount

      public int getPendingCount()
      Gets number of pending replies.
      Returns:
      Pending count