本文整理了Java中org.springframework.amqp.core.Binding.getArguments()
方法的一些代码示例,展示了Binding.getArguments()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.getArguments()
方法的具体详情如下:
包路径:org.springframework.amqp.core.Binding
类名称:Binding
方法名:getArguments
暂无
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void testBindings() throws Exception {
Map<String, Binding> bindings = beanFactory.getBeansOfType(Binding.class);
// 4 for each exchange type
assertEquals(13, bindings.size());
for (Map.Entry<String, Binding> bindingEntry : bindings.entrySet()) {
Binding binding = bindingEntry.getValue();
if ("headers-test".equals(binding.getExchange()) && "bucket".equals(binding.getDestination())) {
Map<String, Object> arguments = binding.getArguments();
assertEquals(3, arguments.size());
break;
}
}
}
代码示例来源: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: 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
@Override
@ManagedOperation(description =
"Remove a binding from the broker (this operation is not available remotely)")
public void removeBinding(final Binding binding) {
this.rabbitTemplate.execute(channel -> {
if (binding.isDestinationQueue()) {
if (isRemovingImplicitQueueBinding(binding)) {
return null;
}
channel.queueUnbind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
else {
channel.exchangeUnbind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
return null;
});
}
代码示例来源:origin: org.springframework.amqp/spring-rabbit
@Override
@ManagedOperation(description =
"Remove a binding from the broker (this operation is not available remotely)")
public void removeBinding(final Binding binding) {
this.rabbitTemplate.execute(channel -> {
if (binding.isDestinationQueue()) {
if (isRemovingImplicitQueueBinding(binding)) {
return null;
}
channel.queueUnbind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
else {
channel.exchangeUnbind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
binding.getArguments());
}
return null;
});
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void testDirectExchange() throws Exception {
DirectExchange exchange = beanFactory.getBean("direct", DirectExchange.class);
assertNotNull(exchange);
assertEquals("direct", exchange.getName());
assertTrue(exchange.isDurable());
assertFalse(exchange.isAutoDelete());
assertFalse(exchange.shouldDeclare());
assertEquals(2, exchange.getDeclaringAdmins().size());
Binding binding =
beanFactory.getBean("org.springframework.amqp.rabbit.config.BindingFactoryBean#0", Binding.class);
assertFalse(binding.shouldDeclare());
assertEquals(2, binding.getDeclaringAdmins().size());
Map<String, Object> arguments = binding.getArguments();
assertNotNull(arguments);
assertEquals(1, arguments.size());
assertTrue(arguments.containsKey("x-match"));
assertEquals("any", arguments.get("x-match"));
}
代码示例来源: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());
}
内容来源于网络,如有侵权,请联系作者删除!