Search in sources :

Example 1 with MetricsCollector

use of org.apache.axis2.transport.base.MetricsCollector in project wso2-axis2-transports by wso2.

the class ProcessPacketTask method run.

public void run() {
    MetricsCollector metrics = endpoint.getMetrics();
    try {
        InputStream inputStream = new ByteArrayInputStream(data, 0, length);
        MessageContext msgContext = endpoint.createMessageContext();
        SOAPEnvelope envelope = TransportUtils.createSOAPMessage(msgContext, inputStream, endpoint.getContentType());
        msgContext.setEnvelope(envelope);
        if (outInfo != null) {
            if (outInfo.getContentType() == null) {
                outInfo.setContentType(endpoint.getContentType());
            }
            msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, outInfo);
        }
        AxisEngine.receive(msgContext);
        metrics.incrementMessagesReceived();
        metrics.incrementBytesReceived(length);
    } catch (Exception ex) {
        metrics.incrementFaultsReceiving();
        StringBuilder buffer = new StringBuilder("Error during processing of datagram:\n");
        Utils.hexDump(buffer, data, length);
        log.error(buffer.toString(), ex);
    }
}
Also used : MetricsCollector(org.apache.axis2.transport.base.MetricsCollector) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) MessageContext(org.apache.axis2.context.MessageContext) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)1 MessageContext (org.apache.axis2.context.MessageContext)1 MetricsCollector (org.apache.axis2.transport.base.MetricsCollector)1