Here are the examples of the java api org.springframework.amqp.core.TopicExchange taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
67 Examples
19
Source : RabbitConfiguration.java
with Apache License 2.0
from ticktok-io
with Apache License 2.0
from ticktok-io
@Bean
public TickChannelOperations tickChannelExplorer(AmqpAdmin amqpAdmin, TopicExchange topicExchange) {
return new RabbitTickChannelOperations(rabbitProperties, amqpAdmin, topicExchange);
}
19
Source : TopicProducerServiceImpl.java
with GNU General Public License v3.0
from gxing19
with GNU General Public License v3.0
from gxing19
/**
* @name: TopicProducerServiceImpl
* @desc: TODO
* @author: gxing
* @date: 2018-10-26 17:33
*/
@Service
public clreplaced TopicProducerServiceImpl implements TopicProducerService {
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private TopicExchange topicExchange;
@Override
public void rabbitMQSendStr(String msg) {
rabbitTemplate.convertAndSend(topicExchange.getName(), "topic.news", "Top Ten News");
}
@Override
public void rabbitMQSendObj(User andy) {
rabbitTemplate.convertAndSend(topicExchange.getName(), "topic.news.nba", "2018-2019 NBA First Battle Start");
}
}
19
Source : TopicRabbitMQConfig.java
with GNU General Public License v3.0
from gxing19
with GNU General Public License v3.0
from gxing19
/**
* 注册交换器
*
* @return
*/
@Bean
public TopicExchange topicExchange() {
TopicExchange exchange = new TopicExchange("topic.exchange", false, true);
return exchange;
}
18
Source : RpcClient.java
with MIT License
from PacktPublishing
with MIT License
from PacktPublishing
public clreplaced RpcClient {
private static final Logger LOG = LoggerFactory.getLogger(RpcClient.clreplaced);
@Autowired
private RabbitTemplate template;
@Autowired
private TopicExchange rpcExchange;
public ServiceResponse invokeService(ServiceRequest request) {
LOG.trace("Exchange: {} ", rpcExchange);
LOG.trace("Service Request: {}", request);
String routingKey = request.getServiceName() + "." + request.getServiceAction();
ServiceResponse response = (ServiceResponse) template.convertSendAndReceive(rpcExchange.getName(), routingKey, request);
LOG.trace("Service Response: {}", response);
return Optional.ofNullable(response).orElse(generateTimedoutResponse(request));
}
private ServiceResponse generateTimedoutResponse(ServiceRequest request) {
ServiceResponse response = new ServiceResponse().withId(UUID.randomUUID().toString()).withCreatedBy("System").withCreatedDate(new Date()).withErrorMessage(new ErrorMessage().withCode("ERR_SERVICE_UNAVAIL").withMessage("Service Unavaialble").withDetails("Internal Error: we are sorry, the " + request.getServiceName() + " is not reachable. Please try again later.")).withStatusCode(Response.Status.SERVICE_UNAVAILABLE.toString()).withRelatedRequest(request.getId());
LOG.trace("Service timeout response: {}", response);
return response;
}
}
18
Source : AmqpPublisher.java
with MIT License
from PacktPublishing
with MIT License
from PacktPublishing
public clreplaced AmqpPublisher {
private static final Logger LOG = LoggerFactory.getLogger(AmqpPublisher.clreplaced);
@Autowired
private RabbitTemplate template;
@Autowired
private TopicExchange replacedxchange;
public void publishEvent(ServiceRequest request) {
LOG.trace("Exchange: {} ", replacedxchange);
LOG.trace("Service Request: {}", request);
String routingKey = request.getServiceName() + "." + request.getServiceAction();
template.convertAndSend(replacedxchange.getName(), routingKey, request);
}
public void publishError(ServiceResponse errorResponse, String routingKey) {
LOG.trace("Exchange: {}", replacedxchange);
LOG.trace("Service Error: {}", errorResponse);
template.convertAndSend(replacedxchange.getName(), routingKey, errorResponse);
}
}
18
Source : RabbitMQClient.java
with Apache License 2.0
from kekingcn
with Apache License 2.0
from kekingcn
private void setDataExchange() {
TopicExchange dataExchange = new TopicExchange(DATA_EXCHANGE, true, false);
amqpAdmin.declareExchange(dataExchange);
this.dataExchange = dataExchange;
}
18
Source : RabbitMQConfig.java
with Apache License 2.0
from kekingcn
with Apache License 2.0
from kekingcn
@Bean("dataExchange")
public TopicExchange dataExchange(ConnectionFactory connectionFactory) {
TopicExchange dataExchange = new TopicExchange(DATA_EXCHANGE, true, false);
new RabbitAdmin(connectionFactory).declareExchange(dataExchange);
return dataExchange;
}
18
Source : Tut5Sender.java
with MIT License
from jarvisqi
with MIT License
from jarvisqi
/**
* @author Jarvis
* @date 2018/7/31
*/
public clreplaced Tut5Sender {
@Autowired
private AmqpTemplate template;
@Autowired
private TopicExchange topicExchange;
private int index;
private int count;
private final String[] keys = { "quick.orange.rabbit", "lazy.orange.elephant", "quick.orange.fox", "lazy.brown.fox", "lazy.pink.rabbit", "quick.brown.fox" };
@Scheduled(fixedDelay = 1000, initialDelay = 500)
public void send() {
StringBuilder builder = new StringBuilder("Hello to ");
if (++this.index == keys.length) {
this.index = 0;
}
String key = keys[this.index];
builder.append(key).append(' ');
builder.append(Integer.toString(++this.count));
String message = builder.toString();
template.convertAndSend(topicExchange.getName(), key, message);
System.out.println(" [x] Sent '" + message + "'");
}
}
18
Source : EmailServiceRabbitConfig.java
with MIT License
from ita-social-projects
with MIT License
from ita-social-projects
/**
* The binding that is used for linking email topic exchange to send habit notification email queue.
*
* @return Binding with topic exchange and send notification queue linked.
*/
@Bean
public Binding sendHabitNotificationTopicBinding(TopicExchange emailTopicExchange) {
return BindingBuilder.bind(sendHabitNotificationQueue()).to(emailTopicExchange).with(SEND_HABIT_NOTIFICATION_ROUTING_KEY);
}
18
Source : EmailServiceRabbitConfig.java
with MIT License
from ita-social-projects
with MIT License
from ita-social-projects
/**
* The binding that is used for linking email topic exchange to preplacedword recovery email queue.
*
* @return Binding with topic exchange and preplacedword recovery queue linked.
*/
@Bean
public Binding preplacedwordRecoveryQueueToEmailTopicBinding(TopicExchange emailTopicExchange) {
return BindingBuilder.bind(preplacedwordRecoveryEmailQueue()).to(emailTopicExchange).with(PreplacedWORD_RECOVERY_ROUTING_KEY);
}
18
Source : EmailServiceRabbitConfig.java
with MIT License
from ita-social-projects
with MIT License
from ita-social-projects
/**
* The binding that is used for linking email topic exchange to send report email queue.
*
* @return Binding with topic exchange and send report queue linked.
*/
@Bean
public Binding sendReportEmailTopicBinding(TopicExchange emailTopicExchange) {
return BindingBuilder.bind(sendReportEmailQueue()).to(emailTopicExchange).with(SEND_REPORT_ROUTING_KEY);
}
18
Source : EmailServiceRabbitConfig.java
with MIT License
from ita-social-projects
with MIT License
from ita-social-projects
/**
* The binding that is used for linking email topic exchange to change place status email queue.
*
* @return Binding with topic exchange and change place status queue linked.
*/
@Bean
public Binding changePlaceStatusQueueToEmailTopicBinding(TopicExchange emailTopicExchange) {
return BindingBuilder.bind(changePlaceStatusEmailQueue()).to(emailTopicExchange).with(CHANGE_PLACE_STATUS_ROUTING_KEY);
}
18
Source : EmailServiceRabbitConfig.java
with MIT License
from ita-social-projects
with MIT License
from ita-social-projects
/**
* The binding that is used for send verify email..
*
* @return Binding with send verify email.
*/
@Bean
public Binding verifyEmailQueueToEmailTopicBinding(TopicExchange emailTopicExchange) {
return BindingBuilder.bind(signUpVerifyEmailQueue()).to(emailTopicExchange).with(VERIFY_EMAIL_ROUTING_KEY);
}
17
Source : BusConfig.java
with Apache License 2.0
from zhoutaoo
with Apache License 2.0
from zhoutaoo
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
log.info("binding {} to {} with {}", queue, exchange, ROUTING_KEY);
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}
17
Source : BusConfig.java
with Apache License 2.0
from zhoutaoo
with Apache License 2.0
from zhoutaoo
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
log.info("binding {} to {} with {}", queue, exchange, QUEUE_NAME);
return BindingBuilder.bind(queue).to(exchange).with(QUEUE_NAME);
}
17
Source : TopicRabbitConfig.java
with Apache License 2.0
from yanghaiji
with Apache License 2.0
from yanghaiji
@Bean
Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) {
return BindingBuilder.bind(queueMessage).to(exchange).with(JAVAYOHO_TOPIC);
}
17
Source : TopicRabbitConfig.java
with Apache License 2.0
from yanghaiji
with Apache License 2.0
from yanghaiji
@Bean
Binding bindingExchangeMessages(Queue queueMessages, TopicExchange exchange) {
return BindingBuilder.bind(queueMessages).to(exchange).with(TOPIC);
}
17
Source : RabbitmqConfig.java
with Apache License 2.0
from xiuhuai
with Apache License 2.0
from xiuhuai
@Bean
Binding bindingExchangeMessages(Queue queueMessages, TopicExchange exchange) {
return BindingBuilder.bind(queueMessages).to(exchange).with("topic.#");
}
17
Source : RabbitmqConfig.java
with Apache License 2.0
from xiuhuai
with Apache License 2.0
from xiuhuai
@Bean
Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) {
return BindingBuilder.bind(queueMessage).to(exchange).with("topic.a");
}
17
Source : TopicRabbitConfig.java
with Apache License 2.0
from WinterChenS
with Apache License 2.0
from WinterChenS
@Bean
Binding bindingExchangeToMessages(Queue queueMessages, TopicExchange exchange) {
return BindingBuilder.bind(queueMessages).to(exchange).with("topic.#");
}
17
Source : TopicRabbitConfig.java
with Apache License 2.0
from WinterChenS
with Apache License 2.0
from WinterChenS
@Bean
Binding bindingExchangeToMessage(Queue queueMessage, TopicExchange exchange) {
return BindingBuilder.bind(queueMessage).to(exchange).with("topic.message");
}
17
Source : TopicConfig.java
with Apache License 2.0
from vipstone
with Apache License 2.0
from vipstone
// 绑定队列到交换器,并设置路由键(log.#)
@Bean
Binding bindingtopicExchangeQueue(Queue queuetopic, TopicExchange topicExchange) {
return BindingBuilder.bind(queuetopic).to(topicExchange).with("log.#");
}
17
Source : TopicConfig.java
with Apache License 2.0
from vipstone
with Apache License 2.0
from vipstone
// 绑定队列到交换器,并设置路由键(log.*.error)
@Bean
Binding bindingtopicExchangeQueue3(Queue queuetopic3, TopicExchange topicExchange) {
return BindingBuilder.bind(queuetopic3).to(topicExchange).with("log.*.error");
}
17
Source : TopicConfig.java
with Apache License 2.0
from vipstone
with Apache License 2.0
from vipstone
// 绑定队列到交换器,并设置路由键(log.*)
@Bean
Binding bindingtopicExchangeQueue2(Queue queuetopic2, TopicExchange topicExchange) {
return BindingBuilder.bind(queuetopic2).to(topicExchange).with("log.*");
}
17
Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine
with Apache License 2.0
from rule-engine
@Bean
public Binding varBindingExchangeMessage(@Qualifier("varQueue") Queue varQueue, @Qualifier("varExchange") TopicExchange varExchange) {
return BindingBuilder.bind(varQueue).to(varExchange).with(VAR_TOPIC_ROUTING_KEY);
}
17
Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine
with Apache License 2.0
from rule-engine
@Bean
public Binding ruleSetBindingExchangeMessage(@Qualifier("ruleSetQueue") Queue ruleSetQueue, @Qualifier("ruleSetExchange") TopicExchange ruleSetExchange) {
return BindingBuilder.bind(ruleSetQueue).to(ruleSetExchange).with(RULE_SET_TOPIC_ROUTING_KEY);
}
17
Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine
with Apache License 2.0
from rule-engine
@Bean
public Binding ruleBindingExchangeMessage(@Qualifier("ruleQueue") Queue ruleQueue, @Qualifier("ruleExchange") TopicExchange ruleExchange) {
return BindingBuilder.bind(ruleQueue).to(ruleExchange).with(RULE_TOPIC_ROUTING_KEY);
}
17
Source : RabbitTopicConfig.java
with Apache License 2.0
from rule-engine
with Apache License 2.0
from rule-engine
@Bean
public Binding decisionTableBindingExchangeMessage(@Qualifier("decisionTableQueue") Queue decisionTableQueue, @Qualifier("decisionTableExchange") TopicExchange decisionTableExchange) {
return BindingBuilder.bind(decisionTableQueue).to(decisionTableExchange).with(DECISION_TABLE_TOPIC_ROUTING_KEY);
}
17
Source : TopicConfig.java
with MIT License
from rexlin600
with MIT License
from rexlin600
/**
* Binding direct exchange a binding
*
* @param topicQueueA topic queue a
* @param topicExchange topic exchange
* @return the binding
*/
@Bean
public Binding bindingDirectExchangeA(Queue topicQueueA, TopicExchange topicExchange) {
return BindingBuilder.bind(topicQueueA).to(topicExchange).with(TOPIC_ROUTINGKEY_A);
}
17
Source : TopicConfig.java
with MIT License
from rexlin600
with MIT License
from rexlin600
/**
* Binding direct exchange all binding
*
* @param topicQueueAll topic queue all
* @param topicExchange topic exchange
* @return the binding
*/
@Bean
public Binding bindingDirectExchangeAll(Queue topicQueueAll, TopicExchange topicExchange) {
return BindingBuilder.bind(topicQueueAll).to(topicExchange).with(TOPIC_ROUTINGKEY_ALL);
}
17
Source : Configurations.java
with MIT License
from PacktPublishing
with MIT License
from PacktPublishing
private List<TopicExchange> eventExchanges() {
return rabbitMqConfig.getEventRoutings().stream().map(rabbitMqConfig::getExchangeName).map(e -> {
TopicExchange exchange = new TopicExchange(e);
exchanegMap.put(e, exchange);
return exchange;
}).collect(Collectors.toList());
}
17
Source : Configurations.java
with MIT License
from PacktPublishing
with MIT License
from PacktPublishing
private List<TopicExchange> serviceExchanges() {
return rabbitMqConfig.getServiceRoutings().stream().map(rabbitMqConfig::getExchangeName).map(e -> {
TopicExchange exchange = new TopicExchange(e);
exchanegMap.put(e, exchange);
return exchange;
}).collect(Collectors.toList());
}
17
Source : RabbitConfig.java
with Apache License 2.0
from mxdldev
with Apache License 2.0
from mxdldev
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(queueName);
}
17
Source : RabbitMqConfig.java
with Apache License 2.0
from michl-b
with Apache License 2.0
from michl-b
@Bean
Binding productBinding(@Qualifier("productQueue") Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with("product");
}
17
Source : RabbitMqConfig.java
with Apache License 2.0
from michl-b
with Apache License 2.0
from michl-b
@Bean
Binding dataBinding(@Qualifier("dataQueue") Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with("data");
}
17
Source : EmailServiceRabbitConfig.java
with MIT License
from ita-social-projects
with MIT License
from ita-social-projects
/**
* Method, that bind {@link this#ecoNewsEmailQueue()} with {@link this#emailTopicExchange()}.
*
* @param emailTopicExchange exchange to bind queue with.
* @param ecoNewsEmailQueue queue to bind exchange with.
* @return binding with {@link this#ecoNewsEmailQueue()} and {@link this#emailTopicExchange()}.
*/
@Bean
public Binding ecoNewsQueueToEmailTopicBinding(TopicExchange emailTopicExchange, Queue ecoNewsEmailQueue) {
return BindingBuilder.bind(ecoNewsEmailQueue).to(emailTopicExchange).with(ADD_ECO_NEWS_ROUTING_KEY);
}
17
Source : RabbitMQConfiguration.java
with MIT License
from hnjaman
with MIT License
from hnjaman
@Bean
Binding binding(final Queue queue, final TopicExchange exchange, @Value("${offer.anything.routing-key}") final String routingKey) {
return BindingBuilder.bind(queue).to(exchange).with(routingKey);
}
17
Source : TopicRabbitMQConfig.java
with GNU General Public License v3.0
from gxing19
with GNU General Public License v3.0
from gxing19
/**
* 订阅新闻下的NBA主题只可以收到NBA新闻
*
* @param queueNewsNba
* @param exchange
* @return
*/
@Bean
public Binding bindingExchangeNewsNba(Queue queueNewsNba, TopicExchange exchange) {
return BindingBuilder.bind(queueNewsNba).to(exchange).with("topic.news.nba");
}
17
Source : TopicRabbitMQConfig.java
with GNU General Public License v3.0
from gxing19
with GNU General Public License v3.0
from gxing19
/**
* 队列绑定到交换器,设置匹配的routing_key
* /
* <p>
* /**
* 订阅新闻主题可以收到所有新闻包括NBA
*
* @param queueNews
* @param topicExchange
* @return
*/
@Bean
public Binding bindingExchangeNews(Queue queueNews, TopicExchange topicExchange) {
return BindingBuilder.bind(queueNews).to(topicExchange).with("topic.news.#");
}
17
Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro
with GNU General Public License v3.0
from gnss-pro
@Bean
Binding bindingJt809LogExchange(Queue webJt809LogQueue, TopicExchange jt809LogExchange) {
return BindingBuilder.bind(webJt809LogQueue).to(jt809LogExchange).with(MqConstant.JT809_LOG_ROUTING_KEY);
}
17
Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro
with GNU General Public License v3.0
from gnss-pro
@Bean
Binding bindingUpCommandExchange(Queue upCommandQueue, TopicExchange upCommandExchange) {
String upCommandRoutingKey = String.format("#.%s.up.command", appName);
return BindingBuilder.bind(upCommandQueue).to(upCommandExchange).with(upCommandRoutingKey);
}
17
Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro
with GNU General Public License v3.0
from gnss-pro
@Bean
Binding bindingJt808LogExchange(Queue webJt808LogQueue, TopicExchange jt808LogExchange) {
return BindingBuilder.bind(webJt808LogQueue).to(jt808LogExchange).with(MqConstant.JT808_LOG_ROUTING_KEY);
}
17
Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro
with GNU General Public License v3.0
from gnss-pro
@Bean
Binding bindingAttachmentExchange(Queue attachmentQueue, TopicExchange attachmentExchange) {
return BindingBuilder.bind(attachmentQueue).to(attachmentExchange).with(MqConstant.ATTACHMENT_ROUTING_KEY);
}
17
Source : MiddlewareConfiguration.java
with GNU General Public License v3.0
from gnss-pro
with GNU General Public License v3.0
from gnss-pro
@Bean
Binding bindingUploadDataExchange(Queue webUploadDataQueue, TopicExchange webUploadDataExchange) {
return BindingBuilder.bind(webUploadDataQueue).to(webUploadDataExchange).with(MqConstant.WEB_UPLOAD_DATA_ROUTING_KEY);
}
17
Source : RabbitMqRelationBindingConfig.java
with MIT License
from FutaoSmile
with MIT License
from FutaoSmile
/**
* Bak绑定
*
* @param queue
* @param exchange
* @return
*/
@Bean("bindingBak")
public Binding bindingBak(@Qualifier("topicQueueBak") @Autowired Queue queue, @Qualifier("topicExchangeBak") @Autowired TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with("topic.#.bak");
}
17
Source : RabbitMqTopicConfig.java
with MIT License
from fujiangwei
with MIT License
from fujiangwei
/**
* 绑定topic.msgs到交换机topicExchange,rotingKey为topic.#,可以匹配以topic.开头的所有的路由Key对应的消息
*
* @param queueMsgs
* @param topicExchange
* @return
*/
@Bean
Binding bindingQueue2Exchange2(Queue queueMsgs, TopicExchange topicExchange) {
return BindingBuilder.bind(queueMsgs).to(topicExchange).with("topic.#");
}
17
Source : RabbitMqTopicConfig.java
with MIT License
from fujiangwei
with MIT License
from fujiangwei
/**
* 绑定topic.msg到交换机topicExchange,rotingKey为topic.#,可以匹配为topic.msg的路由Key对应的消息
*
* @param queueMsg
* @param topicExchange
* @return
*/
@Bean
Binding bindingQueue2Exchange(Queue queueMsg, TopicExchange topicExchange) {
return BindingBuilder.bind(queueMsg).to(topicExchange).with("topic.msg");
}
17
Source : RabbitmqConfig.java
with GNU General Public License v3.0
from boaglio
with GNU General Public License v3.0
from boaglio
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}
17
Source : SampleApplication.java
with Apache License 2.0
from aclement
with Apache License 2.0
from aclement
@Bean
Binding binding(Queue queue, @Qualifier("input") TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with("#");
}
17
Source : CoreRabbitMQConfiguration.java
with GNU Lesser General Public License v2.1
from abixen
with GNU Lesser General Public License v2.1
from abixen
@Bean
List<Binding> binding(TopicExchange exchange) {
List<Binding> bindings = new ArrayList<>();
queues().forEach(queue -> {
bindings.add(BindingBuilder.bind(queue).to(exchange).with(queue.getName()));
});
return bindings;
}
See More Examples