use of org.apache.axis2.transport.rabbitmq.rpc.RabbitMQRPCMessageSender in project wso2-axis2-transports by wso2.
the class RabbitMQSender method sendOverAMQP.
/**
* Perform actual sending of the AMQP message
*/
private void sendOverAMQP(RabbitMQConnectionFactory factory, MessageContext msgContext, String targetEPR) throws AxisFault {
try {
RabbitMQMessage message = new RabbitMQMessage(msgContext);
Hashtable<String, String> epProperties = BaseUtils.getEPRProperties(targetEPR);
if (!StringUtils.isEmpty(epProperties.get(RabbitMQConstants.REPLY_TO_NAME))) {
// request-response scenario
RabbitMQRPCMessageSender sender = new RabbitMQRPCMessageSender(factory, targetEPR, epProperties);
RabbitMQMessage responseMessage = sender.send(message, msgContext);
MessageContext responseMsgCtx = createResponseMessageContext(msgContext);
RabbitMQUtils.setSOAPEnvelope(responseMessage, responseMsgCtx, responseMessage.getContentType());
handleIncomingMessage(responseMsgCtx, RabbitMQUtils.getTransportHeaders(responseMessage), responseMessage.getSoapAction(), responseMessage.getContentType());
} else {
// Basic out only publish
RabbitMQMessageSender sender = new RabbitMQMessageSender(factory, targetEPR, epProperties);
sender.send(message, msgContext);
}
} catch (AxisRabbitMQException e) {
handleException("Error occurred while sending message out", e);
} catch (IOException e) {
handleException("Error occurred while sending message out", e);
}
}
Aggregations