本文整理了Java中org.springframework.amqp.core.Binding.getDestinationType()
方法的一些代码示例,展示了Binding.getDestinationType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.getDestinationType()
方法的具体详情如下:
包路径:org.springframework.amqp.core.Binding
类名称:Binding
方法名:getDestinationType
暂无
代码示例来源:origin: org.springframework.amqp/spring-rabbit
private void declareBindings(final Channel channel, final Binding... bindings) throws IOException {
for (Binding binding : bindings) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Binding destination [" + binding.getDestination() + " (" + binding.getDestinationType()
+ ")] to exchange [" + binding.getExchange() + "] with routing key [" + binding.getRoutingKey()
+ "]");
}
try {
if (binding.isDestinationQueue()) {
if (!isDeclaringImplicitQueueBinding(binding)) {
channel.queueBind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
}
else {
channel.exchangeBind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
}
catch (IOException e) {
logOrRethrowDeclarationException(binding, "binding", e);
}
}
}
代码示例来源:origin: spring-projects/spring-amqp
private void declareBindings(final Channel channel, final Binding... bindings) throws IOException {
for (Binding binding : bindings) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Binding destination [" + binding.getDestination() + " (" + binding.getDestinationType()
+ ")] to exchange [" + binding.getExchange() + "] with routing key [" + binding.getRoutingKey()
+ "]");
}
try {
if (binding.isDestinationQueue()) {
if (!isDeclaringImplicitQueueBinding(binding)) {
channel.queueBind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
}
else {
channel.exchangeBind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
}
catch (IOException e) {
logOrRethrowDeclarationException(binding, "binding", e);
}
}
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void customBinding() {
class CustomExchange extends AbstractExchange {
CustomExchange(String name) {
super(name);
}
@Override
public String getType() {
return "x-custom";
}
}
Object argumentObject = new Object();
CustomExchange customExchange = new CustomExchange("c");
String routingKey = "r";
Binding binding = BindingBuilder.//
bind(queue).//
to(customExchange).//
with(routingKey).//
and(Collections.<String, Object>singletonMap("k", argumentObject));
assertNotNull(binding);
assertEquals(argumentObject, binding.getArguments().get("k"));
assertEquals(customExchange.getName(), binding.getExchange());
assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType());
assertEquals(queue.getName(), binding.getDestination());
assertEquals(routingKey, binding.getRoutingKey());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void fanoutBinding() {
FanoutExchange fanoutExchange = new FanoutExchange("f");
Binding binding = BindingBuilder.bind(queue).to(fanoutExchange);
assertNotNull(binding);
assertEquals(fanoutExchange.getName(), binding.getExchange());
assertEquals("", binding.getRoutingKey());
assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType());
assertEquals(queue.getName(), binding.getDestination());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void directBinding() {
DirectExchange directExchange = new DirectExchange("d");
String routingKey = "r";
Binding binding = BindingBuilder.bind(queue).to(directExchange).with(routingKey);
assertNotNull(binding);
assertEquals(directExchange.getName(), binding.getExchange());
assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType());
assertEquals(queue.getName(), binding.getDestination());
assertEquals(routingKey, binding.getRoutingKey());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void topicBinding() {
TopicExchange topicExchange = new TopicExchange("t");
String routingKey = "r";
Binding binding = BindingBuilder.bind(queue).to(topicExchange).with(routingKey);
assertNotNull(binding);
assertEquals(topicExchange.getName(), binding.getExchange());
assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType());
assertEquals(queue.getName(), binding.getDestination());
assertEquals(routingKey, binding.getRoutingKey());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void exchangeBinding() {
DirectExchange directExchange = new DirectExchange("d");
FanoutExchange fanoutExchange = new FanoutExchange("f");
Binding binding = BindingBuilder.bind(directExchange).to(fanoutExchange);
assertNotNull(binding);
assertEquals(fanoutExchange.getName(), binding.getExchange());
assertEquals(Binding.DestinationType.EXCHANGE, binding.getDestinationType());
assertEquals(directExchange.getName(), binding.getDestination());
assertEquals("", binding.getRoutingKey());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void directBindingWithQueueName() {
DirectExchange directExchange = new DirectExchange("d");
Binding binding = BindingBuilder.bind(queue).to(directExchange).withQueueName();
assertNotNull(binding);
assertEquals(directExchange.getName(), binding.getExchange());
assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType());
assertEquals(queue.getName(), binding.getDestination());
assertEquals(queue.getName(), binding.getRoutingKey());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void headerBinding() {
HeadersExchange headersExchange = new HeadersExchange("h");
String headerKey = "headerKey";
Binding binding = BindingBuilder.bind(queue).to(headersExchange).where(headerKey).exists();
assertNotNull(binding);
assertEquals(headersExchange.getName(), binding.getExchange());
assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType());
assertEquals(queue.getName(), binding.getDestination());
assertEquals("", binding.getRoutingKey());
}
内容来源于网络,如有侵权,请联系作者删除!