org.apache.synapse.transport.passthru

## Class DeliveryAgent

- java.lang.Object
- - org.apache.synapse.transport.passthru.DeliveryAgent

-     public class DeliveryAgent
      extends Object

  This class acts as a gateway for differed delivery of the messages. When a message is to be delivered it is submitted to this class. If a connection is available to the target this class will try to deliver the message immediately over that connection. If a connection is not available it will queue the message and request a connection from the pool. When a new connection is available a queued message will be sent through it.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeliveryAgent(TargetConfiguration targetConfiguration, TargetConnections targetConnections, ProxyConfig proxyConfig)` Create a delivery agent with the target configuration and connection management.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connected(org.apache.http.conn.routing.HttpRoute route, org.apache.http.nio.NHttpClientConnection conn)` Notification for a connection availability.
    `void` | `errorConnecting(org.apache.http.conn.routing.HttpRoute route, int errorCode, String message)`
    `void` | `submit(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.addressing.EndpointReference epr)` This method queues the message for delivery.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DeliveryAgent

          public DeliveryAgent(TargetConfiguration targetConfiguration,
                               TargetConnections targetConnections,
                               ProxyConfig proxyConfig)

      Create a delivery agent with the target configuration and connection management.
      Parameters:
        `targetConfiguration` - configuration of the sender
        `targetConnections` - connection management

  - ### Method Detail

    - #### submit

          public void submit(org.apache.axis2.context.MessageContext msgContext,
                             org.apache.axis2.addressing.EndpointReference epr)
                      throws org.apache.axis2.AxisFault

      This method queues the message for delivery. If a connection is already existing for the destination epr, the message will be delivered immediately. Otherwise message has to wait until a connection is established. In this case this method will inform the system about the need for a connection.
      Parameters:
        `msgContext` - the message context to be sent
        `epr` - the endpoint to which the message should be sent
      Throws:
        `org.apache.axis2.AxisFault` - if an error occurs

    - #### errorConnecting

          public void errorConnecting(org.apache.http.conn.routing.HttpRoute route,
                                      int errorCode,
                                      String message)

    - #### connected

          public void connected(org.apache.http.conn.routing.HttpRoute route,
                                org.apache.http.nio.NHttpClientConnection conn)

      Notification for a connection availability. When this occurs a message in the queue for delivery will be tried.
      Parameters:
        `host` - name of the remote host
        `port` - remote port number

Copyright © 2005–2023 Apache Software Foundation. All rights reserved.