本文整理匯總了Java中org.springframework.amqp.core.Binding類的典型用法代碼示例。如果您正苦於以下問題:Java Binding類的具體用法?Java Binding怎麽用?Java Binding使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Binding類屬於org.springframework.amqp.core包,在下文中一共展示了Binding類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: declareExchange
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Test
public void declareExchange() throws Exception {
RabbitAdmin bean = (RabbitAdmin) applicationContext
.getBean("rabbitAdmin");
//
String EXCHANGE_NAME = "TEST_EXCHANGE";
TopicExchange exchange = new TopicExchange(EXCHANGE_NAME);
bean.declareExchange(exchange);
//
String QUEUE_NAME = "TEST_EXCHANGE";
Queue queue = new Queue(QUEUE_NAME, false);
bean.declareQueue(queue);
//
// binding
Binding binding = BindingBuilder.bind(queue).to(exchange)
.with(QUEUE_NAME);
System.out.println(binding);
}
示例2: configureQueue
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
/**
* Configures the queue and binding based on the messenger specific name.
*/
private void configureQueue()
{
objAdmin = new RabbitAdmin(this.objConnection);
Configuration config = this.objResources.getConfiguration();
String queueName = config.getQueuePrefix() + config.getName() + config.getQueueSuffix();
boolean queueDurability = config.getQueueDurability();
boolean queueAutoDelete = config.getQueueAutoDelete();
boolean queueExclusive = config.getQueueExclusive();
this.objQueue = new Queue(queueName, queueDurability, queueAutoDelete, queueExclusive);
this.objAdmin.declareQueue(this.objQueue);
String bindingName = config.getBindingPrefix() + config.getName() + config.getBindingSuffix();
String bindingExchange = config.getBindingExchange();
this.objBinding = new Binding(this.objQueue.getName(), DestinationType.QUEUE, bindingExchange, bindingName, null);
this.objAdmin.declareBinding(this.objBinding);
}
示例3: afterPropertiesSet
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Override
public void afterPropertiesSet() throws Exception {
List<RabbitAdmin> rabbitAdmins = getMqAdmins();
for (int i = 0; i < rabbitAdmins.size(); i++) {
RabbitAdmin rabbitAdmin = rabbitAdmins.get(i);
while (true) {
if (!DEFAULT_EXCHANGE.equals(exchange)) {
break;
}
try {
rabbitAdmin.declareQueue(new Queue(routingKey, queueDurable, queueExclusive, queueAutoDelete, queueArguments));
rabbitAdmin.declareBinding(new Binding(routingKey, DestinationType.QUEUE, MQClient.DEFAULT_EXCHANGE, routingKey, bindingArguments));
break;
} catch (Exception e) {
LogUtil.warn(logger, "�������У�" + routingKey + "��ʧ��", e);
}
}
}
}
示例4: ticketServiceRequestQueueBinding
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
public Binding ticketServiceRequestQueueBinding()
{
final StringBuilder builder = new StringBuilder();
builder.append(BINDING_TICKET_REQUEST);
String binding = builder.toString();
return BindingBuilder.bind(ticketServiceRequestQueue()).to(ticketServiceRequestExchange()).with(binding);
}
開發者ID:dellemc-symphony,項目名稱:ticketing-service-paqx-parent-sample,代碼行數:12,代碼來源:TicketingServiceRabbitConfig.java
示例5: declareConsumerBindings
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
private Binding declareConsumerBindings(String name, ExtendedConsumerProperties<RabbitConsumerProperties> properties,
Exchange exchange, boolean partitioned, Queue queue) {
if (partitioned) {
return partitionedBinding(name, exchange, queue, properties.getExtension(), properties.getInstanceIndex());
}
else {
return notPartitionedBinding(exchange, queue, properties.getExtension());
}
}
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-binder-rabbit,代碼行數:10,代碼來源:RabbitExchangeQueueProvisioner.java
示例6: autoBindDLQ
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
/**
* If so requested, declare the DLX/DLQ and bind it. The DLQ is bound to the DLX with a routing key of the original
* queue name because we use default exchange routing by queue name for the original message.
* @param baseQueueName The base name for the queue (including the binder prefix, if any).
* @param routingKey The routing key for the queue.
* @param properties the properties.
*/
private void autoBindDLQ(final String baseQueueName, String routingKey, RabbitCommonProperties properties) {
boolean autoBindDlq = properties.isAutoBindDlq();
if (this.logger.isDebugEnabled()) {
this.logger.debug("autoBindDLQ=" + autoBindDlq
+ " for: " + baseQueueName);
}
if (autoBindDlq) {
String dlqName;
if (properties.getDeadLetterQueueName() == null) {
dlqName = constructDLQName(baseQueueName);
}
else {
dlqName = properties.getDeadLetterQueueName();
}
Queue dlq = new Queue(dlqName, true, false, false, queueArgs(dlqName, properties, true));
declareQueue(dlqName, dlq);
String dlxName = deadLetterExchangeName(properties);
final DirectExchange dlx = new DirectExchange(dlxName);
declareExchange(dlxName, dlx);
BindingBuilder.DirectExchangeRoutingKeyConfigurer bindingBuilder = BindingBuilder.bind(dlq).to(dlx);
Binding dlqBinding;
if (properties.getDeadLetterRoutingKey() == null) {
dlqBinding = bindingBuilder.with(routingKey);
}
else {
dlqBinding = bindingBuilder.with(properties.getDeadLetterRoutingKey());
}
declareBinding(dlqName, dlqBinding);
if (properties instanceof RabbitConsumerProperties &&
((RabbitConsumerProperties) properties).isRepublishToDlq()) {
/*
* Also bind with the base queue name when republishToDlq is used, which does not know about
* partitioning
*/
declareBinding(dlqName, BindingBuilder.bind(dlq).to(dlx).with(baseQueueName));
}
}
}
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-binder-rabbit,代碼行數:46,代碼來源:RabbitExchangeQueueProvisioner.java
示例7: rabbitAdmin
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
@Required
RabbitAdmin rabbitAdmin(ConnectionFactory connectionFactory, FanoutExchange fanoutExchange, Queue eventStream, Binding binding) {
RabbitAdmin admin = new RabbitAdmin(connectionFactory);
admin.setAutoStartup(true);
admin.declareExchange(fanoutExchange);
admin.declareQueue(eventStream);
admin.declareBinding(binding);
return admin;
}
示例8: bindReplicationBroadcast
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
public Binding bindReplicationBroadcast(Queue replicationQueue) {
return BindingBuilder
.bind(replicationQueue)
.to(new DirectExchange(replicationExchange))
.with(broadcastKey);
}
示例9: bindReplicationUnicast
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
public Binding bindReplicationUnicast(Queue replicationQueue) {
return BindingBuilder
.bind(replicationQueue)
.to(new DirectExchange(replicationExchange))
.with(nodeId);
}
示例10: bindReplicationUnicast
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
public Binding bindReplicationUnicast(Queue replicationQueue) {
return BindingBuilder
.bind(replicationQueue)
.to(new DirectExchange(replicationExchange))
.with(testNodeId);
}
示例11: bindingReplication
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
public Binding bindingReplication(Queue replicationQueue, DirectExchange replicationExchange) {
return BindingBuilder
.bind(replicationQueue)
.to(replicationExchange)
.with(broadcastKey);
}
示例12: binding
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@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;
}
示例13: prepareQueues
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
public InitializingBean prepareQueues(AmqpAdmin amqpAdmin) {
return () -> {
Queue queue = new Queue(NOTIFICATIONS, true);
DirectExchange exchange = new DirectExchange(NOTIFICATIONS);
Binding binding = BindingBuilder.bind(queue).to(exchange).with(NOTIFICATIONS);
amqpAdmin.declareQueue(queue);
amqpAdmin.declareExchange(exchange);
amqpAdmin.declareBinding(binding);
};
}
示例14: prepareQueues
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@Bean
public InitializingBean prepareQueues(AmqpAdmin amqpAdmin) {
return () -> {
Queue queue = new Queue(this.echoQueueAndExchangeName, true);
DirectExchange exchange = new DirectExchange(this.echoQueueAndExchangeName);
Binding binding = BindingBuilder.bind(queue).to(exchange)
.with(this.echoQueueAndExchangeName);
amqpAdmin.declareQueue(queue);
amqpAdmin.declareExchange(exchange);
amqpAdmin.declareBinding(binding);
};
}
示例15: init
import org.springframework.amqp.core.Binding; //導入依賴的package包/類
@PostConstruct
private void init() throws IOException {
log.info("Initialization of VnfmSpringHelperRabbit");
rabbitAdmin = new RabbitAdmin(connectionFactory);
rabbitAdmin.declareExchange(new TopicExchange("openbaton-exchange"));
rabbitAdmin.declareQueue(
new Queue(RabbitConfiguration.queueName_vnfmRegister, true, exclusive, autodelete));
rabbitAdmin.declareBinding(
new Binding(
RabbitConfiguration.queueName_vnfmRegister,
Binding.DestinationType.QUEUE,
"openbaton-exchange",
RabbitConfiguration.queueName_vnfmRegister,
null));
}