JmsConnectorFactoryBean jmsConnectorFactoryBean = new com.opengamma.util.jms.JmsConnectorFactoryBean();
jmsConnectorFactoryBean.setName("StandardJms");
jmsConnectorFactoryBean.setConnectionFactory(jmsConnectionFactory);
jmsConnectorFactoryBean.setClientBrokerUri(URI.create(activeMQUrl));
JmsConnector jmsConnector = jmsConnectorFactoryBean.getObjectCreating();
ByteArrayFudgeMessageReceiver fudgeReceiver = new ByteArrayFudgeMessageReceiver(new FudgeMessageReceiver() {
@Override
public void messageReceived(FudgeContext fudgeContext, FudgeMsgEnvelope msgEnvelope) {
FudgeMsg message = msgEnvelope.getMessage();
s_logger.debug("received {}", message);
}
}, s_fudgeContext);
final JmsByteArrayMessageDispatcher jmsDispatcher = new JmsByteArrayMessageDispatcher(fudgeReceiver);
Connection connection = jmsConnector.getConnectionFactory().createConnection();
connection.start();
pushTrade("ARG", connection, destinationName, jmsConnector, jmsDispatcher);
Thread.sleep(WAIT_BTW_TRADES);
pushTrade("MMM", connection, destinationName, jmsConnector, jmsDispatcher);