本文整理匯總了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);
}