Java Code Examples for org.springframework.amqp.core.ExchangeTypes#TOPIC

The following examples show how to use org.springframework.amqp.core.ExchangeTypes#TOPIC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GoodsListener.java    From leyou with Apache License 2.0 6 votes vote down vote up
/**
 * 处理insert和update的消息
 *
 * @param id
 * @throws Exception
 */
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "leyou.create.index.queue", durable = "true"),
        exchange = @Exchange(
                value = "leyou.item.exchange",
                ignoreDeclarationExceptions = "true",
                type = ExchangeTypes.TOPIC),
        key = {"item.insert", "item.update"})
)
public void listenCreate(Long id) throws Exception {
    if (id == null) {
        return;
    }
    // 创建或更新索引
    this.searchService.createIndex(id);
}
 
Example 2
Source File: GoodsListener.java    From leyou with Apache License 2.0 6 votes vote down vote up
/**
 * 处理delete的消息
 *
 * @param id
 */
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "leyou.delete.index.queue", durable = "true"),
        exchange = @Exchange(
                value = "leyou.item.exchange",
                ignoreDeclarationExceptions = "true",
                type = ExchangeTypes.TOPIC),
        key = "item.delete")
)
public void listenDelete(Long id) {
    if (id == null) {
        return;
    }
    // 删除索引
    this.searchService.deleteIndex(id);
}
 
Example 3
Source File: GoodsListener.java    From leyou with Apache License 2.0 5 votes vote down vote up
/**
 * 处理insert和update的消息
 *
 * @param id
 * @throws Exception
 */
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "leyou.create.web.queue", durable = "true"),
        exchange = @Exchange(
                value = "leyou.item.exchange",
                ignoreDeclarationExceptions = "true",
                type = ExchangeTypes.TOPIC),
        key = {"item.insert", "item.update"}))
public void listenCreate(Long id) throws Exception {
    if (id == null) {
        return;
    }
    // 创建页面
    goodsHtmlService.createHtml(id);
}
 
Example 4
Source File: GoodsListener.java    From leyou with Apache License 2.0 5 votes vote down vote up
/**
 * 处理delete的消息
 *
 * @param id
 */
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "leyou.delete.web.queue", durable = "true"),
        exchange = @Exchange(
                value = "leyou.item.exchange",
                ignoreDeclarationExceptions = "true",
                type = ExchangeTypes.TOPIC),
        key = "item.delete"))
public void listenDelete(Long id) {
    if (id == null) {
        return;
    }
    // 删除页面
    goodsHtmlService.deleteHtml(id);
}
 
Example 5
Source File: RabbitBroadcasterDBEventStoreIT.java    From eventeum with Apache License 2.0 5 votes vote down vote up
@RabbitListener(bindings = @QueueBinding(
        key = "contractEvents.*",
        value = @Queue("contractEvents"),
        exchange = @Exchange(value = "ThisIsAExchange", type = ExchangeTypes.TOPIC)
))
public void onContractEvent(EventeumMessage message) {
    if(message.getDetails() instanceof ContractEventDetails){
        onContractEventMessageReceived((ContractEventDetails) message.getDetails());
    } else if(message.getDetails() instanceof TransactionDetails){
        onTransactionMessageReceived((TransactionDetails) message.getDetails());
    }
}
 
Example 6
Source File: RabbitBroadcasterDBEventStoreIT.java    From eventeum with Apache License 2.0 5 votes vote down vote up
@RabbitListener(bindings = @QueueBinding(
        key = "transactionEvents.*",
        value = @Queue("transactionEvents"),
        exchange = @Exchange(value = "ThisIsAExchange", type = ExchangeTypes.TOPIC)
))
public void onTransactionEvent(EventeumMessage message) {
    onTransactionMessageReceived((TransactionDetails) message.getDetails());
}
 
Example 7
Source File: RabbitBroadcasterDBEventStoreIT.java    From eventeum with Apache License 2.0 5 votes vote down vote up
@RabbitListener(bindings = @QueueBinding(
        key = "blockEvents",
        value = @Queue("blockEvents"),
        exchange = @Exchange(value = "ThisIsAExchange", type = ExchangeTypes.TOPIC)
))
public void onBlockEvent(EventeumMessage message) {
    onBlockMessageReceived((BlockDetails) message.getDetails());
}
 
Example 8
Source File: BaseRabbitIntegrationTest.java    From eventeum with Apache License 2.0 5 votes vote down vote up
@RabbitListener(bindings = @QueueBinding(
        key = "thisIsRoutingKey.*",
        value = @Queue("ThisIsAEventsQueue"),
        exchange = @Exchange(value = "ThisIsAExchange", type = ExchangeTypes.TOPIC)
))
public void onEvent(EventeumMessage message) {
    if(message.getDetails() instanceof ContractEventDetails){
        getBroadcastContractEvents().add((ContractEventDetails) message.getDetails());
    }
    else if(message.getDetails() instanceof BlockDetails){
        getBroadcastBlockMessages().add((BlockDetails) message.getDetails());
    }

}
 
Example 9
Source File: PrependHello.java    From cukes with Apache License 2.0 5 votes vote down vote up
@RabbitListener(bindings = {
        @QueueBinding(
                value = @Queue,
                exchange = @Exchange(value = RabbitMQConfiguration.EXCHANGE_NAME, type = ExchangeTypes.TOPIC),
                key = "prepend"
        )
})
public void onMessage(StringMessage msg, Message message) {
    String text = msg.getBody();
    System.out.println("PrependHello.onMessage - " + text);
    String result = "hello, " + text;
    template.convertAndSend(message.getMessageProperties().getReplyTo(), new StringMessage(result));
}
 
Example 10
Source File: ToUpperCase.java    From cukes with Apache License 2.0 5 votes vote down vote up
@RabbitListener(bindings = {
        @QueueBinding(
                value = @Queue,
                exchange = @Exchange(value = RabbitMQConfiguration.EXCHANGE_NAME, type = ExchangeTypes.TOPIC),
                key = "upper"
        )
})
public void onMessage(Message message) {
    String text = new String(message.getBody());
    System.out.println("ToUpperCase.onMessage - " + text);
    String result = text.toUpperCase();
    template.convertAndSend(message.getMessageProperties().getReplyTo(), result);
}