Class DeliveryAgent
java.lang.Object
org.apache.synapse.transport.passthru.DeliveryAgent
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
ConstructorsConstructorDescriptionDeliveryAgent(TargetConfiguration targetConfiguration, TargetConnections targetConnections, ProxyConfig proxyConfig) Create a delivery agent with the target configuration and connection management. -
Method Summary
Modifier and TypeMethodDescriptionvoidconnected(RouteRequestMapping routeRequestMapping, org.apache.http.nio.NHttpClientConnection conn) Notification for a connection availability.voiderrorConnecting(org.apache.http.conn.routing.HttpRoute route, int errorCode, String message) voiderrorConnecting(org.apache.http.conn.routing.HttpRoute route, int errorCode, String message, Exception exceptionToRaise) booleansubmit(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.addressing.EndpointReference epr) This method queues the message for delivery.
-
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 sendertargetConnections- 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 sentepr- 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
-
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 hostport- remote port number
-