bcd.setSharedEventOrdering(BrokerConnectionDescriptor.SHARED_ORDER_NONE);
BrokerAdminClient adminClient = BrokerAdminClient.newOrReconnectAdmin(hostName + ":" + port, brokerName, "admin" + System.currentTimeMillis(), "admin",
WMEInitialContextFactory.class.getName(), bcd);
Context ctx = new ContextImpl(environment);
/*
* Lookup all the queues.
*/
final String[] clientIds = adminClient.getClientIds();
for (int i = 0; i < clientIds.length; i++)
{
final BrokerClientInfo info = adminClient.getClientInfoById(clientIds[i]);
if (!ignoreClientGroups.contains(info.client_group))
{
final QueueAdmin queue = AdminFactory.newQueue();
queue.setName(info.client_id);
queue.setClientGroup(info.client_group);
ctx.bind(info.client_id, queue);
}
}
/*
* Create a connection factory for each client group where there is a queue.
*/
final String[] clientGroups = adminClient.getClientGroupNames() ;
for (int i = 0 ; i < clientGroups.length ; i++)
{
final String clientGroup = (String) clientGroups[i] ;
final QueueConnectionFactoryAdmin cfAdmin = AdminFactory.newQueueConnectionFactory();
cfAdmin.setBrokerHost(hostName + ":" + port);
cfAdmin.setBrokerName(brokerName);
cfAdmin.setConnectionClientGroup(clientGroup);
cfAdmin.setConnectionClientId("hermes-" + System.currentTimeMillis());
ctx.bind(clientGroup, cfAdmin);
}
adminClient.destroy();
return ctx;