本文整理汇总了Java中org.springframework.amqp.rabbit.annotation.Queue类的典型用法代码示例。如果您正苦于以下问题:Java Queue类的具体用法?Java Queue怎么用?Java Queue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Queue类属于org.springframework.amqp.rabbit.annotation包,在下文中一共展示了Queue类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.springframework.amqp.rabbit.annotation.Queue; //导入依赖的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();
});
}
示例2: save
import org.springframework.amqp.rabbit.annotation.Queue; //导入依赖的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();
}
示例3: dummyShipGoodsCommand
import org.springframework.amqp.rabbit.annotation.Queue; //导入依赖的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.Queue; //导入依赖的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));
}
示例5: onMessage
import org.springframework.amqp.rabbit.annotation.Queue; //导入依赖的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);
}