Package 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
  Description
  `DeliveryAgent(TargetConfiguration targetConfiguration, TargetConnections targetConnections, ProxyConfig proxyConfig)`
  Create a delivery agent with the target configuration and connection management.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `connected(RouteRequestMapping routeRequestMapping, 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`
  `errorConnecting(org.apache.http.conn.routing.HttpRoute route, int errorCode, String message, Exception exceptionToRaise)`
  `boolean`
  `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 Details

  - ### 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 Details

  - ### submit

    public boolean 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
    Returns:
      false if connection can not be acquired due to connection limit exceeds or queue limit exceeds else return true
    Throws:
      `org.apache.axis2.AxisFault` - if an error occurs

  - ### errorConnecting

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

  - ### errorConnecting

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

  - ### connected

    public void connected(RouteRequestMapping routeRequestMapping, 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