/** * Creates and instance using the given URL * * @param targetEPR the target EPR */ public RabbitMQOutTransportInfo(String targetEPR) { this.targetEPR = targetEPR; if (!targetEPR.startsWith(RabbitMQConstants.RABBITMQ_PREFIX)) { handleException("Invalid prefix for a RabbitMQ AMQP EPR : " + targetEPR); } else { properties = BaseUtils.getEPRProperties(targetEPR); contentTypeProperty = properties.get(RabbitMQConstants.CONTENT_TYPE_PROPERTY_PARAM); } }
/** * Compares two given FIX URL strings. The second URL is considered equal to the * first URL if all the properties in the first URL also exist in the second URL * and if they have equals values. * * @param url1 a FIX URL String * @param url2 a FIX URL String * @return a boolean value */ public static boolean compareURLs(String url1, String url2) { if (!url1.substring(0, url1.indexOf("?")).equals(url2.substring(0, url2.indexOf("?")))) { return false; } else { Hashtable<String,String> properties1 = BaseUtils.getEPRProperties(url1); Hashtable<String, String> properties2 = BaseUtils.getEPRProperties(url2); for (Map.Entry<String,String> entry : properties1.entrySet()) { if (!properties2.containsKey(entry.getKey())) { return false; } else if (!properties1.get(entry.getKey()).equals(entry.getValue())) { return false; } } } return true; }
/** * Constructs a FIXOutTransportInfo out of a FIX EPR. Reads the parameters in the given * EPR and creates a SessionID out of them * * @param targetEPR a valid FIX EPR */ public FIXOutTransportInfo(String targetEPR) { if (!targetEPR.startsWith(FIXConstants.FIX_PREFIX)) { handleException("Invalid FIX EPR " + targetEPR + ". The EPR prefix must be " + FIXConstants.FIX_PREFIX); } else { Hashtable<String,String> properties = BaseUtils.getEPRProperties(targetEPR); this.sessionID = new SessionID( properties.get(FIXConstants.BEGIN_STRING), properties.get(FIXConstants.SENDER_COMP_ID), properties.get(FIXConstants.SENDER_SUB_ID), properties.get(FIXConstants.SENDER_LOCATION_ID), properties.get(FIXConstants.TARGET_COMP_ID), properties.get(FIXConstants.TARGET_SUB_ID), properties.get(FIXConstants.TARGET_LOCATION_ID), properties.get(FIXConstants.SESSION_QUALIFIER)); this.log = LogFactory.getLog(this.getClass()); } }
Map<String,String> properties = BaseUtils.getEPRProperties(outFileURI);
/** * Creates and instance using the given URL * * @param targetEPR the target EPR */ JMSOutTransportInfo(String targetEPR) { this.targetEPR = targetEPR; if (!targetEPR.startsWith(JMSConstants.JMS_PREFIX)) { handleException("Invalid prefix for a JMS EPR : " + targetEPR); } else { properties = BaseUtils.getEPRProperties(targetEPR); String destinationType = properties.get(JMSConstants.PARAM_DEST_TYPE); if (destinationType != null) { setDestinationType(destinationType); } String replyDestinationType = properties.get(JMSConstants.PARAM_REPLY_DEST_TYPE); if (replyDestinationType != null) { setReplyDestinationType(replyDestinationType); } replyDestinationName = properties.get(JMSConstants.PARAM_REPLY_DESTINATION); contentTypeProperty = properties.get(JMSConstants.CONTENT_TYPE_PROPERTY_PARAM); try { context = new InitialContext(properties); } catch (NamingException e) { handleException("Could not get an initial context using " + properties, e); } destination = getDestination(context, targetEPR); replyDestination = getReplyDestination(context, targetEPR); } }
/** * Creates and instance using the given URL * * @param targetEPR the target EPR */ JMSOutTransportInfo(String targetEPR) { this.targetEPR = targetEPR; if (!targetEPR.startsWith(JMSConstants.JMS_PREFIX)) { handleException("Invalid prefix for a JMS EPR : " + targetEPR); } else { properties = BaseUtils.getEPRProperties(targetEPR); String destinationType = properties.get(JMSConstants.PARAM_DEST_TYPE); if (destinationType != null) { setDestinationType(destinationType); } String replyDestinationType = properties.get(JMSConstants.PARAM_REPLY_DEST_TYPE); if (replyDestinationType != null) { setReplyDestinationType(replyDestinationType); } replyDestinationName = properties.get(JMSConstants.PARAM_REPLY_DESTINATION); contentTypeProperty = properties.get(JMSConstants.CONTENT_TYPE_PROPERTY_PARAM); try { context = new InitialContext(properties); } catch (NamingException e) { handleException("Could not get an initial context using " + properties, e); } destination = getDestination(context, targetEPR); replyDestination = getReplyDestination(context, targetEPR); } }
/** * Puts DeliverToX fields in the message to enable the message to be forwarded at the destination. * * @param message the FIX message to be forwarded * @param targetEPR the EPR to which the message will be sent */ private void setDeliverToXFields(Message message, String targetEPR) { Hashtable<String, String> properties = BaseUtils.getEPRProperties(targetEPR); String deliverTo = properties.get(FIXConstants.DELIVER_TO_COMP_ID); //If a DeliverToCompID field is given in EPR put the field in the message if (deliverTo != null) { message.getHeader().setField(new DeliverToCompID(deliverTo)); deliverTo = properties.get(FIXConstants.DELIVER_TO_SUB_ID); if (deliverTo != null) { message.getHeader().setField(new DeliverToSubID(deliverTo)); } deliverTo = properties.get(FIXConstants.DELIVER_TO_LOCATION_ID); if (deliverTo != null) { message.getHeader().setField(new DeliverToLocationID(deliverTo)); } } }
@Override public void sendMessage(MessageContext messageContext, String targetEPR, OutTransportInfo outTransportInfo) throws AxisFault{ Hashtable<String, String> properties; properties = BaseUtils.getEPRProperties(targetEPR); MqttConnectOptions mqttConnectOptions; String mqttBlockingSenderEnable;
Hashtable<String,String> properties = BaseUtils.getEPRProperties(fixEPR); for (Map.Entry<String,String> entry : properties.entrySet()) { settings.setString(sessionID, entry.getKey(), entry.getValue());
/** * 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); } }