當前位置: 首頁>>代碼示例>>Java>>正文


Java Queue類代碼示例

本文整理匯總了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();
		});
}
 
開發者ID:PacktPublishing,項目名稱:Learning-Spring-Boot-2.0-Second-Edition,代碼行數:16,代碼來源:CommentService.java

示例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();
}
 
開發者ID:PacktPublishing,項目名稱:Learning-Spring-Boot-2.0-Second-Edition,代碼行數:12,代碼來源:CommentService.java

示例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));
}
 
開發者ID:ctco,項目名稱:cukes,代碼行數:14,代碼來源:PrependHello.java

示例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);
}
 
開發者ID:ctco,項目名稱:cukes,代碼行數:14,代碼來源:ToUpperCase.java


注:本文中的org.springframework.amqp.rabbit.annotation.Queue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。