Package org.apache.axis2.transport.xmpp
Class XMPPSender
- java.lang.Object
-
- org.apache.axis2.handlers.AbstractHandler
-
- org.apache.axis2.transport.xmpp.XMPPSender
-
- All Implemented Interfaces:
Handler
,TransportSender
public class XMPPSender extends AbstractHandler implements TransportSender
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.axis2.engine.Handler
Handler.InvocationResponse
-
-
Field Summary
-
Fields inherited from class org.apache.axis2.handlers.AbstractHandler
handlerDesc
-
-
Constructor Summary
Constructors Constructor Description XMPPSender()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup(MessageContext msgContext)
Release resources associated with a given message context.void
init(ConfigurationContext confContext, TransportOutDescription transportOut)
Initialize the transport sender by reading pre-defined connection factories for outgoing messages.Handler.InvocationResponse
invoke(MessageContext msgContext)
This method will be called on each registered handler when a message needs to be processed.static void
processChatMessage(MessageContext msgCtx)
Process message requests that came in through chat clientsvoid
sendMessage(MessageContext msgCtx, String targetAddress, OutTransportInfo outTransportInfo)
Send the given message over XMPP transportvoid
stop()
-
Methods inherited from class org.apache.axis2.handlers.AbstractHandler
flowComplete, getHandlerDesc, getName, getParameter, init, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.axis2.engine.Handler
flowComplete, getHandlerDesc, getName, getParameter, init
-
-
-
-
Method Detail
-
cleanup
public void cleanup(MessageContext msgContext) throws AxisFault
Description copied from interface:TransportSender
Release resources associated with a given message context. This method is called after processing the response of an invocation of a synchronous out-in operation to allow the transport to release any resources allocated during that invocation.This method is mainly useful for connection oriented transports that return from
Handler.invoke(MessageContext)
before the entire response is available. A transport of this type will construct anInputStream
object and set it as theMessageContext.TRANSPORT_IN
property on theOperationContext
). In order for this to work, the connection must remain open until the response has been processed. This method is then used to release the connection explicitly.- Specified by:
cleanup
in interfaceTransportSender
- Throws:
AxisFault
-
init
public void init(ConfigurationContext confContext, TransportOutDescription transportOut) throws AxisFault
Initialize the transport sender by reading pre-defined connection factories for outgoing messages. These will create sessions (one per each destination dealt with) to be used when messages are being sent.- Specified by:
init
in interfaceTransportSender
- Parameters:
confContext
- the configuration contexttransportOut
- the transport sender definition from axis2.xml- Throws:
AxisFault
- on error
-
stop
public void stop()
- Specified by:
stop
in interfaceTransportSender
-
invoke
public Handler.InvocationResponse invoke(MessageContext msgContext) throws AxisFault
Description copied from interface:Handler
This method will be called on each registered handler when a message needs to be processed. If the message processing is paused by the handler, then this method will be called again for the handler that paused the processing once it is resumed. This method may be called concurrently from multiple threads. Handlers that want to determine the type of message that is to be processed (e.g. response vs request, inbound vs. outbound, etc.) can retrieve that information from the MessageContext via MessageContext.getFLOW() and MessageContext.getAxisOperation().getMessageExchangePattern() APIs.
-
sendMessage
public void sendMessage(MessageContext msgCtx, String targetAddress, OutTransportInfo outTransportInfo) throws AxisFault
Send the given message over XMPP transport- Parameters:
msgCtx
- the axis2 message context- Throws:
AxisFault
- on error
-
processChatMessage
public static void processChatMessage(MessageContext msgCtx) throws AxisFault
Process message requests that came in through chat clients- Parameters:
msgCtx
-- Throws:
AxisFault
-
-