protected JmsEndpoint createQueueEndpoint(String uri, JmsComponent component, String subject, JmsConfiguration configuration, QueueBrowseStrategy queueBrowseStrategy) { return new JmsQueueEndpoint(uri, component, subject, configuration, queueBrowseStrategy); }
public JmsQueueEndpoint(String endpointUri, String destination, QueueBrowseStrategy queueBrowseStrategy) { super(endpointUri, destination, false); setDestinationType("queue"); if (queueBrowseStrategy == null) { this.queueBrowseStrategy = createQueueBrowseStrategy(); } else { this.queueBrowseStrategy = queueBrowseStrategy; } }
public JmsQueueEndpoint(Queue destination) throws JMSException { this("jms:queue:" + destination.getQueueName(), null); setDestinationType("queue"); setDestination(destination); }
public List<Exchange> doInJms(Session session, QueueBrowser browser) throws JMSException { int size = endpoint.getMaximumBrowseSize(); if (size <= 0) { size = Integer.MAX_VALUE; } // not the best implementation in the world as we have to browse // the entire queue, which could be massive List<Exchange> answer = new ArrayList<>(); Enumeration<?> iter = browser.getEnumeration(); for (int i = 0; i < size && iter.hasMoreElements(); i++) { Message message = (Message) iter.nextElement(); Exchange exchange = endpoint.createExchange(message, session); answer.add(exchange); } return answer; } });
public List<Exchange> getExchanges() { if (queueBrowseStrategy == null) { return Collections.emptyList(); } String queue = getDestinationName(); JmsOperations template = getConfiguration().createInOnlyTemplate(this, false, queue); return queueBrowseStrategy.browse(template, queue, this); }
public JmsQueueEndpoint(String uri, JmsComponent component, String destination, JmsConfiguration configuration) { this(uri, component, destination, configuration, null); setDestinationType("queue"); }
public List<Exchange> browse(JmsOperations template, String queue, final JmsQueueEndpoint endpoint) { if (endpoint.getSelector() != null) { return template.browseSelected(queue, endpoint.getSelector(), new BrowserCallback<List<Exchange>>() { public List<Exchange> doInJms(Session session, QueueBrowser browser) throws JMSException { int size = endpoint.getMaximumBrowseSize();
public List<Exchange> doInJms(Session session, QueueBrowser browser) throws JMSException { int size = endpoint.getMaximumBrowseSize(); if (size <= 0) { size = Integer.MAX_VALUE; } // not the best implementation in the world as we have to browse // the entire queue, which could be massive List<Exchange> answer = new ArrayList<>(); Enumeration<?> iter = browser.getEnumeration(); for (int i = 0; i < size && iter.hasMoreElements(); i++) { Message message = (Message) iter.nextElement(); Exchange exchange = endpoint.createExchange(message, session); answer.add(exchange); } return answer; } });
/** * Returns a new JMS endpoint for the given JMS destination */ public static JmsEndpoint newInstance(Destination destination) throws JMSException { if (destination instanceof TemporaryQueue) { return new JmsTemporaryQueueEndpoint((TemporaryQueue) destination); } else if (destination instanceof TemporaryTopic) { return new JmsTemporaryTopicEndpoint((TemporaryTopic) destination); } else if (destination instanceof Queue) { return new JmsQueueEndpoint((Queue) destination); } else { return new JmsEndpoint((Topic) destination); } }
public JmsQueueEndpoint(String uri, JmsComponent component, String destination, JmsConfiguration configuration, QueueBrowseStrategy queueBrowseStrategy) { super(uri, component, destination, false, configuration); setDestinationType("queue"); if (queueBrowseStrategy == null) { this.queueBrowseStrategy = createQueueBrowseStrategy(); } else { this.queueBrowseStrategy = queueBrowseStrategy; } }
protected void addQueue(ActiveMQQueue queue) throws Exception { String queueUri = getQueueUri(queue); ActiveMQComponent jmsComponent = getComponent(); Endpoint endpoint = new JmsQueueEndpoint(queueUri, jmsComponent, queue.getPhysicalName(), jmsComponent.getConfiguration()); camelContext.addEndpoint(queueUri, endpoint); }
public JmsQueueEndpoint(String endpointUri, String destination) { super(endpointUri, destination, false); setDestinationType("queue"); queueBrowseStrategy = createQueueBrowseStrategy(); }
protected void addQueue(ActiveMQQueue queue) throws Exception { String queueUri = getQueueUri(queue); ActiveMQComponent jmsComponent = getComponent(); Endpoint endpoint = new JmsQueueEndpoint(queueUri, jmsComponent, queue.getPhysicalName(), jmsComponent.getConfiguration()); camelContext.addEndpoint(queueUri, endpoint); }