broker.getRegistry().addComponentPacketListener(this);
try {
resourceAdapter = createResourceAdapter();
// Inbound connector
ActiveMQActivationSpec ac = new ActiveMQActivationSpec();
ac.setDestinationType("javax.jms.Queue");
ac.setDestination(INBOUND_PREFIX + broker.getContainerName());
containerConnector = new JCAConnector();
containerConnector.setBootstrapContext(getBootstrapContext());
containerConnector.setActivationSpec(ac);
containerConnector.setResourceAdapter(resourceAdapter);
containerConnector.setEndpointFactory(new SingletonEndpointFactory(this, getTransactionManager()));
containerConnector.afterPropertiesSet();
// Outbound connector
ActiveMQManagedConnectionFactory mcf = new ActiveMQManagedConnectionFactory();
mcf.setResourceAdapter(resourceAdapter);
ConnectionFactory cf = (ConnectionFactory) mcf.createConnectionFactory(getConnectionManager());
jmsTemplate = new JmsTemplate(cf);
jmsTemplate.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
jmsPersistentTemplate = new JmsTemplate(cf);
jmsPersistentTemplate.setDeliveryMode(DeliveryMode.PERSISTENT);
// Inbound broadcast
ac = new ActiveMQActivationSpec();
ac.setDestinationType("javax.jms.Topic");
ac.setDestination(broadcastDestinationName);
broadcastConnector = new JCAConnector();
broadcastConnector.setBootstrapContext(getBootstrapContext());
broadcastConnector.setActivationSpec(ac);
broadcastConnector.setResourceAdapter(resourceAdapter);
broadcastConnector.setEndpointFactory(new SingletonEndpointFactory(this));