org.springframework.amqp.core.Queue

Here are the examples of the java api org.springframework.amqp.core.Queue taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

127 Examples 7

19 Source : BusConfig.java
with Apache License 2.0
from zhoutaoo

@Bean
Binding binding(Queue queue, TopicExchange exchange) {
    log.info("binding {} to {} with {}", queue, exchange, ROUTING_KEY);
    return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}

19 Source : BusConfig.java
with Apache License 2.0
from zhoutaoo

@Bean
Binding binding(Queue queue, TopicExchange exchange) {
    log.info("binding {} to {} with {}", queue, exchange, QUEUE_NAME);
    return BindingBuilder.bind(queue).to(exchange).with(QUEUE_NAME);
}

19 Source : TopicRabbitConfig.java
with Apache License 2.0
from yanghaiji

@Bean
Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessage).to(exchange).with(JAVAYOHO_TOPIC);
}

19 Source : TopicRabbitConfig.java
with Apache License 2.0
from yanghaiji

@Bean
Binding bindingExchangeMessages(Queue queueMessages, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessages).to(exchange).with(TOPIC);
}

19 Source : RabbitConfig.java
with Apache License 2.0
from xiuhuai

@Bean
public Queue queue() {
    Queue queue = new Queue("delay_queue_1", true);
    return queue;
}

19 Source : RabbitmqConfig.java
with Apache License 2.0
from xiuhuai

@Bean
Binding bindingExchangeMessages(Queue queueMessages, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessages).to(exchange).with("topic.#");
}

19 Source : RabbitmqConfig.java
with Apache License 2.0
from xiuhuai

@Bean
Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessage).to(exchange).with("topic.a");
}

19 Source : OrderDeadLetterConfig.java
with GNU General Public License v3.0
from xiaomujiayou

// 声明死信队列绑定关系
@Bean
public Binding orderLetterBinding(Queue orderLetterQueue) {
    return BindingBuilder.bind(orderLetterQueue).to(new DirectExchange(OrderMqConfig.EXCHANGE)).with(OrderMqConfig.KEY_PROCESS_FAIL);
}

19 Source : TopicRabbitConfig.java
with Apache License 2.0
from WinterChenS

@Bean
Binding bindingExchangeToMessages(Queue queueMessages, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessages).to(exchange).with("topic.#");
}

19 Source : TopicRabbitConfig.java
with Apache License 2.0
from WinterChenS

@Bean
Binding bindingExchangeToMessage(Queue queueMessage, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessage).to(exchange).with("topic.message");
}

19 Source : TopicConfig.java
with Apache License 2.0
from vipstone

// 绑定队列到交换器,并设置路由键(log.#)
@Bean
Binding bindingtopicExchangeQueue(Queue queuetopic, TopicExchange topicExchange) {
    return BindingBuilder.bind(queuetopic).to(topicExchange).with("log.#");
}

19 Source : TopicConfig.java
with Apache License 2.0
from vipstone

// 绑定队列到交换器,并设置路由键(log.*.error)
@Bean
Binding bindingtopicExchangeQueue3(Queue queuetopic3, TopicExchange topicExchange) {
    return BindingBuilder.bind(queuetopic3).to(topicExchange).with("log.*.error");
}

19 Source : TopicConfig.java
with Apache License 2.0
from vipstone

// 绑定队列到交换器,并设置路由键(log.*)
@Bean
Binding bindingtopicExchangeQueue2(Queue queuetopic2, TopicExchange topicExchange) {
    return BindingBuilder.bind(queuetopic2).to(topicExchange).with("log.*");
}

19 Source : MqAutoConfiguration.java
with MIT License
from uhonliu

@Bean
public Queue accessLogsQueue() {
    Queue queue = new Queue(QueueConstants.QUEUE_ACCESS_LOGS);
    log.info("Query {} [{}]", QueueConstants.QUEUE_ACCESS_LOGS, queue);
    return queue;
}

19 Source : MqAutoConfiguration.java
with MIT License
from uhonliu

/**
 * direct模式,直接根据队列名称投递消息
 *
 * @return
 */
@Bean
public Queue apiResourceQueue() {
    Queue queue = new Queue(QueueConstants.QUEUE_SCAN_API_RESOURCE);
    log.info("Query {} [{}]", QueueConstants.QUEUE_SCAN_API_RESOURCE, queue);
    return queue;
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createQueueWithDeadLetterAndDeadLetterConfig() {
    defaultQueueConfig = QueueConfig.builder().deadLetterEnabled(true).build();
    queueConfig = QueueConfig.builder().name(queueName).deadLetterEnabled(true).argument("key1", "value1").build().applyDefaultConfig(defaultQueueConfig);
    deadLetterConfig = DeadLetterConfig.builder().deadLetterExchange(ExchangeConfig.builder().name("dead-letter-exchange").build()).queuePostfix(".dlq-new").build();
    expectedQueueConfig = QueueConfig.builder().name(queueName).durable(false).autoDelete(false).exclusive(false).deadLetterEnabled(true).argument("key1", "value1").argument("x-dead-letter-exchange", "dead-letter-exchange").argument("x-dead-letter-routing-key", queueName + ".dlq-new").build();
    Queue queue = queueConfig.buildQueue(defaultQueueConfig, deadLetterConfig);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createQueueWithDeadLetterAndDefaultDeadLetterConfig() {
    defaultQueueConfig = QueueConfig.builder().deadLetterEnabled(true).build();
    queueConfig = QueueConfig.builder().name(queueName).deadLetterEnabled(true).argument("key1", "value1").build().applyDefaultConfig(defaultQueueConfig);
    deadLetterConfig = DeadLetterConfig.builder().deadLetterExchange(ExchangeConfig.builder().name("dead-letter-exchange").build()).build();
    expectedQueueConfig = QueueConfig.builder().name(queueName).durable(false).autoDelete(false).exclusive(false).deadLetterEnabled(true).argument("key1", "value1").argument("x-dead-letter-exchange", "dead-letter-exchange").argument("x-dead-letter-routing-key", queueName + ".DLQ").build();
    Queue queue = queueConfig.buildQueue(defaultQueueConfig, deadLetterConfig);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createQueueWithFewDefaultConfigurationTest() {
    defaultQueueConfig = QueueConfig.builder().durable(true).autoDelete(true).exclusive(true).deadLetterEnabled(false).argument("key1", "value1").build();
    queueConfig = QueueConfig.builder().name(queueName).durable(false).autoDelete(false).argument("key2", "value2").argument("key1", "NEW_VALUE").build().applyDefaultConfig(defaultQueueConfig);
    expectedQueueConfig = QueueConfig.builder().name(queueName).durable(false).autoDelete(false).exclusive(true).deadLetterEnabled(true).argument("key2", "value2").argument("key1", "NEW_VALUE").build();
    Queue queue = queueConfig.buildQueue(defaultQueueConfig, null);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createQueueWithNoDeadLetterAndDefaultConfigurationPreAppliedTest() {
    defaultQueueConfig = QueueConfig.builder().build();
    queueConfig = QueueConfig.builder().name(queueName).build().applyDefaultConfig(defaultQueueConfig);
    expectedQueueConfig = QueueConfig.builder().name(queueName).durable(false).autoDelete(false).exclusive(false).deadLetterEnabled(false).arguments(new HashMap<>()).build();
    Queue queue = queueConfig.buildQueue(defaultQueueConfig, null);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createQueueWithNoDeadLetterAndDefaultConfigurationAppliedTest() {
    defaultQueueConfig = QueueConfig.builder().build();
    queueConfig = QueueConfig.builder().name(queueName).build();
    expectedQueueConfig = QueueConfig.builder().name(queueName).durable(false).autoDelete(false).exclusive(false).deadLetterEnabled(false).arguments(new HashMap<>()).build();
    Queue queue = queueConfig.buildQueue(defaultQueueConfig, null);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createDeadLetterQueueWithDefaultConfigurationPreAppliedTest() {
    defaultQueueConfig = QueueConfig.builder().deadLetterEnabled(true).build();
    queueConfig = QueueConfig.builder().name(queueName).build().applyDefaultConfig(defaultQueueConfig);
    deadLetterConfig = DeadLetterConfig.builder().deadLetterExchange(ExchangeConfig.builder().name("dead-letter-exchange").build()).queuePostfix(".dlq-new").build();
    expectedQueueConfig = QueueConfig.builder().name(queueName + ".dlq-new").durable(false).autoDelete(false).exclusive(false).deadLetterEnabled(true).arguments(new HashMap<>()).build();
    Queue queue = queueConfig.buildDeadLetterQueue(defaultQueueConfig, deadLetterConfig);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createQueueWithNoDeadLetterAndNoDeadLetterConfig() {
    defaultQueueConfig = QueueConfig.builder().deadLetterEnabled(false).build();
    queueConfig = QueueConfig.builder().name(queueName).build();
    expectedQueueConfig = QueueConfig.builder().name(queueName).durable(false).autoDelete(false).exclusive(false).deadLetterEnabled(false).build();
    Queue queue = queueConfig.buildQueue(defaultQueueConfig, null);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfigTest.java
with Apache License 2.0
from societe-generale

@Test
public void createDeadLetterQueueWithDefaultConfigurationAppliedTest() {
    defaultQueueConfig = QueueConfig.builder().deadLetterEnabled(true).build();
    queueConfig = QueueConfig.builder().name(queueName).build();
    deadLetterConfig = DeadLetterConfig.builder().deadLetterExchange(ExchangeConfig.builder().name("dead-letter-exchange").build()).queuePostfix(".dlq-new").build();
    expectedQueueConfig = QueueConfig.builder().name(queueName + ".dlq-new").durable(false).autoDelete(false).exclusive(false).arguments(new HashMap<>()).build();
    Queue queue = queueConfig.buildDeadLetterQueue(defaultQueueConfig, deadLetterConfig);
    replacedertQueue(queue, expectedQueueConfig);
}

19 Source : QueueConfig.java
with Apache License 2.0
from societe-generale

public Queue buildQueue(QueueConfig defaultQueueConfig, DeadLetterConfig deadLetterConfig) {
    if (!isDefaultConfigApplied()) {
        applyDefaultConfig(defaultQueueConfig);
    }
    Queue queue = new Queue(getName(), getDurable(), getExclusive(), getAutoDelete(), getArguments());
    if (Boolean.TRUE.equals(getDeadLetterEnabled())) {
        if (deadLetterConfig == null || deadLetterConfig.getDeadLetterExchange() == null) {
            throw new RabbitmqConfigurationException(String.format("Invalid configuration %s : DeadLetterConfig/DeadLetterExchange must be provided when deadLetterEnabled=true for queue %s.", getName(), getName()));
        }
        queue.getArguments().put("x-dead-letter-exchange", deadLetterConfig.getDeadLetterExchange().getName());
        queue.getArguments().put("x-dead-letter-routing-key", deadLetterConfig.createDeadLetterQueueName(getName()));
    }
    return queue;
}

19 Source : RabbitmqConfiguration.java
with Apache License 2.0
from sdc1234

/**
 * 配置知乎问题队列 bean
 *
 * @param rabbitAdmin
 * @return
 */
@Bean
public Queue userBehaviorDataQueue(@Autowired RabbitAdmin rabbitAdmin) {
    // 创建知乎问题队列对象
    Queue ubdQueue = new Queue("zhuhu.question.queue");
    // 声明知乎问题队列
    rabbitAdmin.declareQueue(ubdQueue);
    // 返回知乎问题队列
    return ubdQueue;
}

19 Source : RabbitmqConfiguration.java
with Apache License 2.0
from sdc1234

/**
 * 配置知乎用户资料队列 bean
 *
 * @param rabbitAdmin
 * @return
 */
@Bean
public Queue zhihuUserDataQueue(@Autowired RabbitAdmin rabbitAdmin) {
    // 创建知乎用户资料队列对象
    Queue ubdQueue = new Queue("zhuhu.user.queue");
    // 声明知乎用户资料队列
    rabbitAdmin.declareQueue(ubdQueue);
    // 返回知乎用户资料队列
    return ubdQueue;
}

19 Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine

@Bean
public Binding varBindingExchangeMessage(@Qualifier("varQueue") Queue varQueue, @Qualifier("varExchange") TopicExchange varExchange) {
    return BindingBuilder.bind(varQueue).to(varExchange).with(VAR_TOPIC_ROUTING_KEY);
}

19 Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine

@Bean
public Binding ruleSetBindingExchangeMessage(@Qualifier("ruleSetQueue") Queue ruleSetQueue, @Qualifier("ruleSetExchange") TopicExchange ruleSetExchange) {
    return BindingBuilder.bind(ruleSetQueue).to(ruleSetExchange).with(RULE_SET_TOPIC_ROUTING_KEY);
}

19 Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine

@Bean
public Binding ruleBindingExchangeMessage(@Qualifier("ruleQueue") Queue ruleQueue, @Qualifier("ruleExchange") TopicExchange ruleExchange) {
    return BindingBuilder.bind(ruleQueue).to(ruleExchange).with(RULE_TOPIC_ROUTING_KEY);
}

19 Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine

@Bean
public Binding decisionTableBindingExchangeMessage(@Qualifier("decisionTableQueue") Queue decisionTableQueue, @Qualifier("decisionTableExchange") TopicExchange decisionTableExchange) {
    return BindingBuilder.bind(decisionTableQueue).to(decisionTableExchange).with(DECISION_TABLE_TOPIC_ROUTING_KEY);
}

19 Source : TopicConfig.java
with MIT License
from rexlin600

/**
 * Binding direct exchange a binding
 *
 * @param topicQueueA   topic queue a
 * @param topicExchange topic exchange
 * @return the binding
 */
@Bean
public Binding bindingDirectExchangeA(Queue topicQueueA, TopicExchange topicExchange) {
    return BindingBuilder.bind(topicQueueA).to(topicExchange).with(TOPIC_ROUTINGKEY_A);
}

19 Source : TopicConfig.java
with MIT License
from rexlin600

/**
 * Binding direct exchange all binding
 *
 * @param topicQueueAll topic queue all
 * @param topicExchange topic exchange
 * @return the binding
 */
@Bean
public Binding bindingDirectExchangeAll(Queue topicQueueAll, TopicExchange topicExchange) {
    return BindingBuilder.bind(topicQueueAll).to(topicExchange).with(TOPIC_ROUTINGKEY_ALL);
}

19 Source : SendRequestEventLogin.java
with MIT License
from PacktPublishing

@Service
@RepositoryEventHandler
public clreplaced SendRequestEventLogin {

    private RabbitTemplate rabbitTemplate;

    private Queue queue;

    public SendRequestEventLogin(Queue queue, RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
        this.queue = queue;
    }

    @HandleAfterCreate
    public LoginDetails loginHandler(String content) {
        return send(content);
    }

    public LoginDetails send(String content) {
        System.out.println("send request");
        LoginDetails results = (LoginDetails) rabbitTemplate.convertSendAndReceive(queue.getName(), content);
        return results;
    }
}

19 Source : SendAsyncEventLogin.java
with MIT License
from PacktPublishing

@Service
@RepositoryEventHandler
public clreplaced SendAsyncEventLogin {

    private AsyncRabbitTemplate asyncRabbitTemplate;

    private Queue requestQueue;

    public SendAsyncEventLogin(Queue requestQueue, AsyncRabbitTemplate rabbitTemplate) {
        this.asyncRabbitTemplate = rabbitTemplate;
        // this.asyncRabbitTemplate.setReceiveTimeout(1000);
        this.requestQueue = requestQueue;
    }

    @HandleAfterCreate
    public DeferredResult<LoginDetails> loginHandler(String content) {
        return send(content);
    }

    public DeferredResult<LoginDetails> send(String content) {
        System.out.println("send request");
        final DeferredResult<LoginDetails> response = new DeferredResult<>();
        ListenableFuture<LoginDetails> future = asyncRabbitTemplate.convertSendAndReceive(requestQueue.getName(), content);
        future.addCallback(new LoginHandlerResponse(response));
        System.out.println(asyncRabbitTemplate.isAutoStartup());
        System.out.println(asyncRabbitTemplate.isRunning());
        return response;
    }

    private static clreplaced LoginHandlerResponse implements ListenableFutureCallback<LoginDetails> {

        private DeferredResult<LoginDetails> result;

        public LoginHandlerResponse(DeferredResult<LoginDetails> result) {
            this.result = result;
        }

        @Override
        public void onFailure(Throwable throwable) {
            result.setResult(new LoginDetails());
        }

        @Override
        public void onSuccess(LoginDetails response) {
            result.setResult(response);
        }
    }
}

19 Source : CardSubscription.java
with Mozilla Public License 2.0
from opfab

/**
 * <p>Constructs a non durable queue to cardExchange using queue name
 * [user login]Groups#[client id].</p>
 * @return
 */
private Queue createQueue() {
    log.debug("CREATE queue for user {}", userLogin);
    Queue queue = QueueBuilder.nonDurable(queueName).build();
    amqpAdmin.declareQueue(queue);
    Binding binding = BindingBuilder.bind(queue).to(cardExchange);
    amqpAdmin.declareBinding(binding);
    return queue;
}

19 Source : RabbitConfig.java
with Apache License 2.0
from mxdldev

@Bean
Binding binding(Queue queue, TopicExchange exchange) {
    return BindingBuilder.bind(queue).to(exchange).with(queueName);
}

19 Source : RabbitMqConfig.java
with Apache License 2.0
from michl-b

@Bean
Binding productBinding(@Qualifier("productQueue") Queue queue, TopicExchange exchange) {
    return BindingBuilder.bind(queue).to(exchange).with("product");
}

19 Source : RabbitMqConfig.java
with Apache License 2.0
from michl-b

@Bean
Binding dataBinding(@Qualifier("dataQueue") Queue queue, TopicExchange exchange) {
    return BindingBuilder.bind(queue).to(exchange).with("data");
}

19 Source : RabbitMQConfiguration.java
with MIT License
from hnjaman

@Bean
Binding binding(final Queue queue, final TopicExchange exchange, @Value("${offer.anything.routing-key}") final String routingKey) {
    return BindingBuilder.bind(queue).to(exchange).with(routingKey);
}

19 Source : TopicRabbitMQConfig.java
with GNU General Public License v3.0
from gxing19

/**
 * 订阅新闻下的NBA主题只可以收到NBA新闻
 *
 * @param queueNewsNba
 * @param exchange
 * @return
 */
@Bean
public Binding bindingExchangeNewsNba(Queue queueNewsNba, TopicExchange exchange) {
    return BindingBuilder.bind(queueNewsNba).to(exchange).with("topic.news.nba");
}

19 Source : TopicRabbitMQConfig.java
with GNU General Public License v3.0
from gxing19

/**
 * 队列绑定到交换器,设置匹配的routing_key
 * /
 * <p>
 * /**
 * 订阅新闻主题可以收到所有新闻包括NBA
 *
 * @param queueNews
 * @param topicExchange
 * @return
 */
@Bean
public Binding bindingExchangeNews(Queue queueNews, TopicExchange topicExchange) {
    return BindingBuilder.bind(queueNews).to(topicExchange).with("topic.news.#");
}

19 Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro

@Bean
Binding bindingJt809LogExchange(Queue webJt809LogQueue, TopicExchange jt809LogExchange) {
    return BindingBuilder.bind(webJt809LogQueue).to(jt809LogExchange).with(MqConstant.JT809_LOG_ROUTING_KEY);
}

19 Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro

@Bean
Binding bindingUpCommandExchange(Queue upCommandQueue, TopicExchange upCommandExchange) {
    String upCommandRoutingKey = String.format("#.%s.up.command", appName);
    return BindingBuilder.bind(upCommandQueue).to(upCommandExchange).with(upCommandRoutingKey);
}

19 Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro

@Bean
Binding bindingRpcExchange(Queue rpcQueue, TopicExchange rpcExchange) {
    return BindingBuilder.bind(rpcQueue).to(rpcExchange).with(MqConstant.WEB_RPC_ROUTING_KEY);
}

19 Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro

@Bean
Binding bindingJt808LogExchange(Queue webJt808LogQueue, TopicExchange jt808LogExchange) {
    return BindingBuilder.bind(webJt808LogQueue).to(jt808LogExchange).with(MqConstant.JT808_LOG_ROUTING_KEY);
}

19 Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro

@Bean
Binding bindingAttachmentExchange(Queue attachmentQueue, TopicExchange attachmentExchange) {
    return BindingBuilder.bind(attachmentQueue).to(attachmentExchange).with(MqConstant.ATTACHMENT_ROUTING_KEY);
}

19 Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro

@Bean
Binding bindingUploadDataExchange(Queue webUploadDataQueue, TopicExchange webUploadDataExchange) {
    return BindingBuilder.bind(webUploadDataQueue).to(webUploadDataExchange).with(MqConstant.WEB_UPLOAD_DATA_ROUTING_KEY);
}

19 Source : RabbitMqRelationBindingConfig.java
with MIT License
from FutaoSmile

/**
 * 消息队列与Exchange进行绑定
 *
 * @param queue    消息队列
 * @param exchange 交换器
 * @return
 */
@Bean("binding")
public Binding binding(@Qualifier("topicQueue") @Autowired Queue queue, @Qualifier("topicExchange") @Autowired TopicExchange exchange) {
    return BindingBuilder.bind(queue).to(exchange).with("foo.bar.#");
}

19 Source : RabbitMqRelationBindingConfig.java
with MIT License
from FutaoSmile

/**
 * Bak绑定
 *
 * @param queue
 * @param exchange
 * @return
 */
@Bean("bindingBak")
public Binding bindingBak(@Qualifier("topicQueueBak") @Autowired Queue queue, @Qualifier("topicExchangeBak") @Autowired TopicExchange exchange) {
    return BindingBuilder.bind(queue).to(exchange).with("topic.#.bak");
}

19 Source : RabbitMqTopicConfig.java
with MIT License
from fujiangwei

/**
 * 绑定topic.msgs到交换机topicExchange,rotingKey为topic.#,可以匹配以topic.开头的所有的路由Key对应的消息
 *
 * @param queueMsgs
 * @param topicExchange
 * @return
 */
@Bean
Binding bindingQueue2Exchange2(Queue queueMsgs, TopicExchange topicExchange) {
    return BindingBuilder.bind(queueMsgs).to(topicExchange).with("topic.#");
}

See More Examples