List of usage examples for org.springframework.amqp.core Queue getName
public String getName()
From source file:io.curly.tagger.config.AmqpConfiguration.java
@Bean Binding binding(TopicExchange artifactoryExchange, Queue tagQueue) { return BindingBuilder.bind(tagQueue).to(artifactoryExchange).with(tagQueue.getName()); }
From source file:io.curly.artifact.integration.config.AmqpConfiguration.java
@Bean Binding tagBinding(TopicExchange exchange, Queue tagQueue) { return BindingBuilder.bind(tagQueue).to(exchange).with(tagQueue.getName()); }
From source file:io.curly.artifact.integration.config.AmqpConfiguration.java
@Bean Binding categoryBinding(TopicExchange exchange, Queue categoryQueue) { return BindingBuilder.bind(categoryQueue).to(exchange).with(categoryQueue.getName()); }
From source file:io.curly.artifact.integration.config.AmqpConfiguration.java
@Bean Binding notifierBinding(TopicExchange notificationExchange, Queue notifierQueue) { return BindingBuilder.bind(notifierQueue).to(notificationExchange).with(notifierQueue.getName()); }
From source file:io.curly.advisor.integration.config.AmqpConfiguration.java
@Bean Binding notificationBinding(Queue notificationQueue, TopicExchange notificationExchange) { return BindingBuilder.bind(notificationQueue).to(notificationExchange).with(notificationQueue.getName()); }
From source file:com.noriental.solr.config.test.BrokerRunning.java
public void removeTestQueues() { CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); connectionFactory.setHost("localhost"); RabbitAdmin admin = new RabbitAdmin(connectionFactory); for (Queue queue : this.queues) { admin.deleteQueue(queue.getName()); }/*from w w w .jav a2 s . com*/ connectionFactory.destroy(); }
From source file:com.jbrisbin.vpc.jobsched.ListenClosure.java
/** * Tie a Groovy closure to a message callback. * * @param args/*from w ww .ja v a 2 s . c o m*/ * @return The BlockingQueue to poll for results */ @Override public Object call(Object[] args) { final Closure callback = (args.length > 0 && args[0] instanceof Closure ? (Closure) args[0] : null); if (null == callback) { throw new IllegalStateException( "You must provide a callback to listen() (otherwise, what's the point?)"); } Queue replyQueue = rabbitAdmin.declareQueue(); listener = new SimpleMessageListenerContainer(connectionFactory); listener.setQueues(replyQueue); final Listener helper = new Listener(replyQueue.getName()); listener.setMessageListener(new MessageListener() { public void onMessage(Message message) { byte[] body = message.getBody(); try { Object obj = mapper.readValue(body, 0, body.length, Map.class); helper.getResultsQueue() .add(callback.call(new Object[] { obj, message.getMessageProperties() })); } catch (IOException e) { log.error(e.getMessage(), e); } if ("end".equals(message.getMessageProperties().getType())) { helper.getResultsQueue().add(false); } } }); listener.start(); return helper; }
From source file:com.noriental.solr.config.test.BrokerRunning.java
@Override public Statement apply(Statement base, Description description) { // Check at the beginning, so this can be used as a static field if (assumeOnline) { Assume.assumeTrue(brokerOnline.get(port)); } else {/*from w ww.j a v a2s . co m*/ Assume.assumeTrue(brokerOffline.get(port)); } CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); connectionFactory.setHost("localhost"); try { connectionFactory.setPort(port); if (StringUtils.hasText(hostName)) { connectionFactory.setHost(hostName); } RabbitAdmin admin = new RabbitAdmin(connectionFactory); for (Queue queue : queues) { String queueName = queue.getName(); if (purge) { logger.debug("Deleting queue: " + queueName); // Delete completely - gets rid of consumers and bindings as well admin.deleteQueue(queueName); } if (isDefaultQueue(queueName)) { // Just for test probe. admin.deleteQueue(queueName); } else { admin.declareQueue(queue); } } brokerOffline.put(port, false); if (!assumeOnline) { Assume.assumeTrue(brokerOffline.get(port)); } if (this.management) { Client client = new Client("http://localhost:15672/api/", "guest", "guest"); if (!client.alivenessTest("/")) { throw new RuntimeException( "Aliveness test failed for localhost:15672 guest/quest; " + "management not available"); } } } catch (AmqpTimeoutException e) { fail("Timed out getting connection"); } catch (Exception e) { logger.warn("Not executing tests because basic connectivity test failed", e); brokerOnline.put(port, false); if (assumeOnline) { Assume.assumeNoException(e); } } finally { connectionFactory.destroy(); } return super.apply(base, description); }
From source file:com.github.larsq.spring.embeddedamqp.SimpleAmqpMessageContainer.java
public QueueInfo queueDeclare(Queue queue) { Optional<Queue> reference = queue(queue.getName()); consumers.computeIfAbsent(reference.orElse(queue), __ -> new ArrayList<>()); ConsumerSubscription defaultSubscription = new ConsumerSubscription(null, String.join(".", SYSTEM, queue.getName()), new QueueingConsumer(100, true)); consumers.get(reference.orElse(queue)).add(defaultSubscription); return new QueueInfo(this, queue.getName()); }
From source file:com.github.larsq.spring.embeddedamqp.SimpleAmqpMessageContainer.java
void route(Queue queue, Message message) throws IOException { LOG.debug("route message {} to queue {}", message.getEnvelope(), queue); String defaultTag = String.join(".", SYSTEM, queue.getName()); SuppressedThrowable<IOException> suppressed = SuppressedThrowable.wrap(IOException.class); Queue key = queue(queue.getName()).orElseThrow(Exception.queueNotFound(queue.getName())); List<AbstractSubscription<Consumer>> list = consumers.get(key); LOG.debug("found {} consumers", list.size()); Optional<QueueingConsumer> queueingConsumer = subscription(String.join(".", SYSTEM, queue.getName())) .filter(untyped(instanceOf(QueueingConsumer.class))).map(c -> (QueueingConsumer) c); queueingConsumer.ifPresent(c -> c.setEnabled(list.size() == 1)); LOG.debug("found queue: {}", queueingConsumer.isPresent()); list.forEach(Unchecked.consumer(s -> s.onMessage(message), suppressed)); suppressed.check();/* w ww . j a v a 2s .com*/ }