From inside PushConsumer.onMessage(), how can I create a queue and add a push consumer to that queue? Here's a failing attempt:
// create queue
ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName()));
ClientSessionFactory sf = serverLocator.createSessionFactory();
ClientSession coreSession = sf.createSession(false, false, false);
final String queueName = "queue.exampleQueue";
coreSession.createQueue(queueName, queueName, true);
// add consumer
PushStore pushStore = QueueServiceManager().getPushStore();
PushRegistration reg = new PushRegistration();
reg.setDestination("http://somewhere.com/rest/service");
reg.setEnabled(true);
pushStore.add(reg);