/** * Constructs the listener which will listen on the given queue. * * @param queue the queue to listen to */ public HzQueueListener(IQueue<Object> queue) { this.queue = queue; registrationId = this.queue.addItemListener(this, false); }
public void init() { if (queue != null) { registrationId = queue.addItemListener(this, true); } else { queue = instance.getQueue(Constants.QUEUE); registrationId = queue.addItemListener(this, true); } executorService.execute(this); }
public void init() { if (queue != null) { registrationId = queue.addItemListener(this, true); } else { queue = instance.getQueue(Constants.QUEUE); registrationId = queue.addItemListener(this, true); } executorService.execute(this); }
protected void handleAddListener(String[] args) { String first = args[0]; if (first.startsWith("s.")) { getSet().addItemListener(this, true); } else if (first.startsWith("m.")) { if (args.length > 1) { getMap().addEntryListener(this, args[1], true); } else { getMap().addEntryListener(this, true); } } else if (first.startsWith("mm.")) { if (args.length > 1) { getMultiMap().addEntryListener(this, args[1], true); } else { getMultiMap().addEntryListener(this, true); } } else if (first.startsWith("q.")) { getQueue().addItemListener(this, true); } else if (first.startsWith("t.")) { getTopic().addMessageListener(this); } else if (first.startsWith("l.")) { getList().addItemListener(this, true); } }
protected void handleAddListener(String[] args) { String first = args[0]; if (first.startsWith("s.")) { getSet().addItemListener(this, true); } else if (first.startsWith("m.")) { if (args.length > 1) { getMap().addEntryListener(this, args[1], true); } else { getMap().addEntryListener(this, true); } } else if (first.startsWith("mm.")) { if (args.length > 1) { getMultiMap().addEntryListener(this, args[1], true); } else { getMultiMap().addEntryListener(this, true); } } else if (first.startsWith("q.")) { getQueue().addItemListener(this, true); } else if (first.startsWith("t.")) { getTopic().addMessageListener(this); } else if (first.startsWith("l.")) { getList().addItemListener(this, true); } }
protected void handleAddListener(String[] args) { String first = args[0]; if (first.startsWith("s.")) { getSet().addItemListener(this, true); } else if (first.startsWith("m.")) { if (args.length > 1) { getMap().addEntryListener(this, args[1], true); } else { getMap().addEntryListener(this, true); } } else if (first.startsWith("mm.")) { if (args.length > 1) { getMultiMap().addEntryListener(this, args[1], true); } else { getMultiMap().addEntryListener(this, true); } } else if (first.startsWith("q.")) { getQueue().addItemListener(this, true); } else if (first.startsWith("t.")) { getTopic().addMessageListener(this); } else if (first.startsWith("l.")) { getList().addItemListener(this, true); } }
@Override public void run() { IQueue<Object> queue = hazelcastInstance.getQueue(cacheName); if (config.getQueueConsumerMode() == HazelcastQueueConsumerMode.LISTEN) { queue.addItemListener(camelItemListener, true); } if (config.getQueueConsumerMode() == HazelcastQueueConsumerMode.POLL) { while (isRunAllowed()) { try { final Object body = queue.poll(config.getPollingTimeout(), TimeUnit.MILLISECONDS); Exchange exchange = getEndpoint().createExchange(); exchange.getOut().setBody(body); try { processor.process(exchange); } catch (Exception e) { getExceptionHandler().handleException("Error during processing", exchange, e); } } catch (InterruptedException e) { if (LOG.isDebugEnabled()) { LOG.debug("Hazelcast Queue Consumer Interrupted: {}", e, e); continue; } } } } } }
protected void handleAddListener(String[] args) { String first = args[0]; if (first.startsWith("s.")) { getSet().addItemListener(this, true); } else if (first.startsWith("m.")) { if (args.length > 1) { getMap().addEntryListener(this, args[1], true); } else { getMap().addEntryListener(this, true); } } else if (first.startsWith("mm.")) { if (args.length > 1) { getMultiMap().addEntryListener(this, args[1], true); } else { getMultiMap().addEntryListener(this, true); } } else if (first.startsWith("q.")) { getQueue().addItemListener(this, true); } else if (first.startsWith("t.")) { getTopic().addMessageListener(this); } else if (first.startsWith("l.")) { getList().addItemListener(this, true); } }
.addItemListener(new HazelcastItemListener(), true));