Example usage for org.springframework.amqp.core FanoutExchange FanoutExchange

List of usage examples for org.springframework.amqp.core FanoutExchange FanoutExchange

Introduction

In this page you can find the example usage for org.springframework.amqp.core FanoutExchange FanoutExchange.

Prototype

public FanoutExchange(String name) 

Source Link

Usage

From source file:com.baocy.tut3.Tut3Config.java

@Bean
public FanoutExchange fanout() {
    return new FanoutExchange("tut.fanout");
}

From source file:lab.example.service.LotteryService.java

@Bean
public FanoutExchange fanoutExchange() {
    return new FanoutExchange(exchangeName);
}

From source file:lab.example.service.MessageListener.java

@Bean
public FanoutExchange fanoutExchangeA() {
    return new FanoutExchange(exchangeName);
}

From source file:vn.topmedia.monitor.rabbit.config.AbstractRabbitConfiguration.java

@Bean
public FanoutExchange marketDataExchange() {
    return new FanoutExchange(monitorExchangeName);
}

From source file:com.jbrisbin.vpc.jobsched.mapred.MapReduceMessageHandler.java

public void start() {
    phase = STARTING;//from  w ww  .  j  a  v a2s.co m
    controlQueue = rabbitAdmin.declareQueue();
    FanoutExchange x = new FanoutExchange(mapreduceControlExchange);
    rabbitAdmin.declareExchange(x);
    rabbitAdmin.declareBinding(new Binding(controlQueue, x));

    listeners = new SimpleMessageListenerContainer(connectionFactory);
    listeners.setMessageListener(new MapReduceControlHandler());
    listeners.setQueues(controlQueue);
    listeners.start();

    phase = STARTED;
}

From source file:com.jbrisbin.vpc.jobsched.QueueConfiguration.java

@Bean
public FanoutExchange mapreduceControlExchange() {
    FanoutExchange x = new FanoutExchange(mapreduceControlExchName);
    return x;
}

From source file:org.springframework.integration.x.rabbit.RabbitChannelRegistry.java

@Override
public void tap(String tapModule, final String name, MessageChannel tapModuleInputChannel) {
    SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(
            this.connectionFactory);
    if (this.concurrentConsumers != null) {
        listenerContainer.setConcurrentConsumers(this.concurrentConsumers);
    }/* w w  w  . j  a  v  a  2s  . c  om*/
    Queue queue = this.rabbitAdmin.declareQueue();
    Binding binding = BindingBuilder.bind(queue).to(new FanoutExchange("tap." + name));
    this.rabbitAdmin.declareBinding(binding);
    listenerContainer.setQueues(queue);
    listenerContainer.afterPropertiesSet();
    AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(listenerContainer);
    DirectChannel bridgeToTapChannel = new DirectChannel();
    bridgeToTapChannel.setBeanName(tapModule + ".bridge");
    adapter.setOutputChannel(bridgeToTapChannel);
    adapter.setHeaderMapper(this.mapper);
    adapter.setBeanName("tap." + name);
    adapter.setComponentName(tapModule + "." + "tapAdapter");
    adapter.afterPropertiesSet();
    this.lifecycleBeans.add(adapter);
    // TODO: media types need to be passed in by Tap.
    Collection<MediaType> acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
    ReceivingHandler convertingBridge = new ReceivingHandler(acceptedMediaTypes);
    convertingBridge.setOutputChannel(tapModuleInputChannel);
    convertingBridge.setBeanName(name + ".convert.bridge");
    convertingBridge.afterPropertiesSet();
    bridgeToTapChannel.subscribe(convertingBridge);
    adapter.start();
}

From source file:org.springframework.integration.x.rabbit.RabbitMessageBus.java

@Override
public void bindPubSubConsumer(String name, MessageChannel moduleInputChannel) {
    FanoutExchange exchange = new FanoutExchange("topic." + name);
    rabbitAdmin.declareExchange(exchange);
    Queue queue = new AnonymousQueue();
    this.rabbitAdmin.declareQueue(queue);
    org.springframework.amqp.core.Binding binding = BindingBuilder.bind(queue).to(exchange);
    this.rabbitAdmin.declareBinding(binding);
    // register with context so they will be redeclared after a connection failure
    this.autoDeclareContext.getBeanFactory().registerSingleton(queue.getName(), queue);
    if (!autoDeclareContext.containsBean(exchange.getName() + ".binding")) {
        this.autoDeclareContext.getBeanFactory().registerSingleton(exchange.getName() + ".binding", binding);
    }//from   w w w .j av a2s. c o  m
    doRegisterConsumer(name, moduleInputChannel, queue);
}

From source file:org.springframework.integration.x.rabbit.RabbitMessageBus.java

@Override
public void bindPubSubProducer(String name, MessageChannel moduleOutputChannel) {
    rabbitAdmin.declareExchange(new FanoutExchange("topic." + name));
    AmqpOutboundEndpoint fanout = new AmqpOutboundEndpoint(rabbitTemplate);
    fanout.setExchangeName("topic." + name);
    fanout.setHeaderMapper(mapper);/*from   www.j  a  v a  2 s.c  om*/
    fanout.afterPropertiesSet();
    doRegisterProducer(name, moduleOutputChannel, fanout);
}

From source file:org.springframework.xd.dirt.integration.rabbit.RabbitMessageBus.java

@Override
public void bindPubSubConsumer(String name, MessageChannel moduleInputChannel, Properties properties) {
    if (logger.isInfoEnabled()) {
        logger.info("declaring pubsub for inbound: " + name);
    }//from  w w w .  j  a  v  a2s .  c o m
    RabbitPropertiesAccessor accessor = new RabbitPropertiesAccessor(properties);
    validateConsumerProperties(name, properties, SUPPORTED_PUBSUB_CONSUMER_PROPERTIES);
    String prefix = accessor.getPrefix(this.defaultPrefix);
    FanoutExchange exchange = new FanoutExchange(prefix + "topic." + name);
    declareExchangeIfNotPresent(exchange);
    String uniqueName = name + "." + UUID.randomUUID().toString();
    Queue queue = new Queue(prefix + uniqueName, false, true, true);
    declareQueueIfNotPresent(queue);
    org.springframework.amqp.core.Binding binding = BindingBuilder.bind(queue).to(exchange);
    this.rabbitAdmin.declareBinding(binding);
    // register with context so they will be redeclared after a connection failure
    this.autoDeclareContext.getBeanFactory().registerSingleton(queue.getName(), queue);
    String bindingBeanName = exchange.getName() + "." + queue.getName() + ".binding";
    if (!autoDeclareContext.containsBean(bindingBeanName)) {
        this.autoDeclareContext.getBeanFactory().registerSingleton(bindingBeanName, binding);
    }
    doRegisterConsumer(name, moduleInputChannel, queue, accessor, true);
    autoBindDLQ(uniqueName, accessor);
}