@Override public void onInit() { super.onInit(); this.dispatcher = this.createDispatcher(); if (this.maxSubscribers == null) { this.maxSubscribers = this.getIntegrationProperty(this.isPubSub ? IntegrationProperties.CHANNELS_MAX_BROADCAST_SUBSCRIBERS : IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS, Integer.class); } setMaxSubscribers(this.maxSubscribers); String queue = obtainQueueName(this.channelName); this.container.setQueueNames(queue); MessageConverter converter = (this.getAmqpTemplate() instanceof RabbitTemplate) ? ((RabbitTemplate) this.getAmqpTemplate()).getMessageConverter() : new SimpleMessageConverter(); MessageListener listener = new DispatchingMessageListener(converter, this.dispatcher, this, this.isPubSub, getMessageBuilderFactory(), getInboundHeaderMapper()); this.container.setMessageListener(listener); if (!this.container.isActive()) { this.container.afterPropertiesSet(); } }
@Override public void setQueueNames(String... queueName) { super.setQueueNames(queueName); queuesChanged(); }
@Override public void setQueueNames(String... queueName) { Assert.state(!isRunning(), "Cannot set queue names while running, use add/remove"); super.setQueueNames(queueName); }
@Override public void setQueueNames(String... queueName) { Assert.state(!isRunning(), "Cannot set queue names while running, use add/remove"); super.setQueueNames(queueName); }
@Override public void setQueueNames(String... queueName) { super.setQueueNames(queueName); queuesChanged(); }
this.template.setRoutingKey(routingKey); this.container = new SimpleMessageListenerContainer(connectionFactory); this.container.setQueueNames(replyQueue); this.container.setMessageListener(this); this.container.afterPropertiesSet();
this.template.setRoutingKey(routingKey); this.container = new SimpleMessageListenerContainer(connectionFactory); this.container.setQueueNames(replyQueue); this.container.setMessageListener(this); this.container.afterPropertiesSet();
@Override public void setupListenerContainer(MessageListenerContainer listenerContainer) { AbstractMessageListenerContainer container = (AbstractMessageListenerContainer) listenerContainer; boolean queuesEmpty = getQueues().isEmpty(); boolean queueNamesEmpty = getQueueNames().isEmpty(); if (!queuesEmpty && !queueNamesEmpty) { throw new IllegalStateException("Queues or queue names must be provided but not both for " + this); } if (queuesEmpty) { Collection<String> names = getQueueNames(); container.setQueueNames(names.toArray(new String[names.size()])); } else { Collection<Queue> instances = getQueues(); container.setQueues(instances.toArray(new Queue[instances.size()])); } container.setExclusive(isExclusive()); if (getPriority() != null) { Map<String, Object> args = new HashMap<String, Object>(); args.put("x-priority", getPriority()); container.setConsumerArguments(args); } if (getAdmin() != null) { container.setAmqpAdmin(getAdmin()); } setupMessageListener(listenerContainer); }
@Override public void setupListenerContainer(MessageListenerContainer listenerContainer) { AbstractMessageListenerContainer container = (AbstractMessageListenerContainer) listenerContainer; boolean queuesEmpty = getQueues().isEmpty(); boolean queueNamesEmpty = getQueueNames().isEmpty(); if (!queuesEmpty && !queueNamesEmpty) { throw new IllegalStateException("Queues or queue names must be provided but not both for " + this); } if (queuesEmpty) { Collection<String> names = getQueueNames(); container.setQueueNames(names.toArray(new String[names.size()])); } else { Collection<Queue> instances = getQueues(); container.setQueues(instances.toArray(new Queue[instances.size()])); } container.setExclusive(isExclusive()); if (getPriority() != null) { Map<String, Object> args = new HashMap<String, Object>(); args.put("x-priority", getPriority()); container.setConsumerArguments(args); } if (getAdmin() != null) { container.setAmqpAdmin(getAdmin()); } setupMessageListener(listenerContainer); }
container.setConnectionFactory(cf); container.setShutdownTimeout(500); container.setQueueNames("test.shutdown"); final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch testEnded = new CountDownLatch(1);
latch.countDown(); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
throw new RuntimeException("force rollback"); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
latch.countDown(); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setExposeListenerChannel(false);
latch.countDown(); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
latch.countDown(); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
latch.countDown(); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
latch.countDown(); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
: new AmqpRejectAndDontRequeueException("force rollback"); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
latch.countDown(); }); container.setQueueNames("queue"); container.setChannelTransacted(true); container.setShutdownTimeout(100);
@Override public void onInit() { super.onInit(); this.dispatcher = this.createDispatcher(); if (this.maxSubscribers == null) { this.maxSubscribers = this.getIntegrationProperty(this.isPubSub ? IntegrationProperties.CHANNELS_MAX_BROADCAST_SUBSCRIBERS : IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS, Integer.class); } setMaxSubscribers(this.maxSubscribers); String queue = obtainQueueName(this.channelName); this.container.setQueueNames(queue); MessageConverter converter = (this.getAmqpTemplate() instanceof RabbitTemplate) ? ((RabbitTemplate) this.getAmqpTemplate()).getMessageConverter() : new SimpleMessageConverter(); MessageListener listener = new DispatchingMessageListener(converter, this.dispatcher, this, this.isPubSub, getMessageBuilderFactory(), getInboundHeaderMapper()); this.container.setMessageListener(listener); if (!this.container.isActive()) { this.container.afterPropertiesSet(); } }