当前位置: 首页>>代码示例>>Java>>正文


Java QueueBinding类代码示例

本文整理汇总了Java中org.springframework.amqp.rabbit.annotation.QueueBinding的典型用法代码示例。如果您正苦于以下问题:Java QueueBinding类的具体用法?Java QueueBinding怎么用?Java QueueBinding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QueueBinding类属于org.springframework.amqp.rabbit.annotation包,在下文中一共展示了QueueBinding类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import org.springframework.amqp.rabbit.annotation.QueueBinding; //导入依赖的package包/类
@RabbitListener(bindings = @QueueBinding(
	value = @Queue,
	exchange = @Exchange(value = "learning-spring-boot"),
	key = "comments.new"
))
public void save(Comment newComment) {
	repository
		.save(newComment)
		.log("commentService-save")
		.subscribe(comment -> {
			meterRegistry
				.counter("comments.consumed", "imageId", comment.getImageId())
				.increment();
		});
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-Boot-2.0-Second-Edition,代码行数:16,代码来源:CommentService.java

示例2: save

import org.springframework.amqp.rabbit.annotation.QueueBinding; //导入依赖的package包/类
@RabbitListener(bindings = @QueueBinding(
	value = @Queue,
	exchange = @Exchange(value = "learning-spring-boot"),
	key = "comments.new"
))
public void save(Comment newComment) {
	repository
		.save(newComment)
		.log("commentService-save")
		.subscribe();
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-Boot-2.0-Second-Edition,代码行数:12,代码来源:CommentService.java

示例3: dummyShipGoodsCommand

import org.springframework.amqp.rabbit.annotation.QueueBinding; //导入依赖的package包/类
/**
 * Dummy method to handle the shipGoods command message - as we do not have a 
 * shipping system available in this small example
 */
@RabbitListener(bindings = @QueueBinding( //
    value = @Queue(value = "shipping_create_test", durable = "true"), //
    exchange = @Exchange(value = "shipping", type = "topic", durable = "true"), //
    key = "*"))
@Transactional  
public void dummyShipGoodsCommand(String orderId) {
  // and call back directly with a generated transactionId
  handleGoodsShippedEvent(orderId, UUID.randomUUID().toString());
}
 
开发者ID:berndruecker,项目名称:camunda-spring-boot-amqp-microservice-cloud-example,代码行数:14,代码来源:AmqpReceiver.java

示例4: onMessage

import org.springframework.amqp.rabbit.annotation.QueueBinding; //导入依赖的package包/类
@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));
}
 
开发者ID:ctco,项目名称:cukes,代码行数:14,代码来源:PrependHello.java

示例5: onMessage

import org.springframework.amqp.rabbit.annotation.QueueBinding; //导入依赖的package包/类
@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);
}
 
开发者ID:ctco,项目名称:cukes,代码行数:14,代码来源:ToUpperCase.java


注:本文中的org.springframework.amqp.rabbit.annotation.QueueBinding类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。