Skip to content

Commit

Permalink
Merge branch 'master' of github.com:a-dubaj/AsynchronousMessaging
Browse files Browse the repository at this point in the history
  • Loading branch information
a-dubaj committed Apr 21, 2022
2 parents 3dc62a8 + 59cf8c3 commit 6a02da5
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.andrzejdubaj.rabbitmqdemoapp;

import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.MessageListenerContainer;
Expand All @@ -18,6 +18,23 @@ Queue myQueue() {
return new Queue(MY_QUEUE, true);
}

@Bean
Exchange myExchange() {
return ExchangeBuilder.topicExchange("TopicExchange")
.durable(true)
.build();
}

@Bean
Binding binding() {
//return new Binding(MY_QUEUE, Binding.DestinationType.QUEUE, "MyTopicExchange", "topic", null);
return BindingBuilder
.bind(myQueue())
.to(myExchange())
.with("topic")
.noargs();
}

@Bean
ConnectionFactory connectionFactory() {
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory("localhost");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class RabbitMQQueueConfiguration {
Queue exampleQueue() {
return new Queue("ExampleQueue", false);
}

@Bean
Queue example2andQueue() {
return QueueBuilder.durable("Example2ndQueue")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,51 @@
package com.andrzejdubaj.rabbitmqdemoapp;

import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.ExchangeBuilder;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RabbitMqExchangeConfiguration {

@Bean
Exchange exampleExchange() {
return new TopicExchange("ExampleExchange");
}

@Bean
Exchange example2exchange() {
return ExchangeBuilder.directExchange("Example2exchange")
.autoDelete()
.internal()
.build();
}

@Bean
Exchange newExchange() {
return ExchangeBuilder.topicExchange("TopicTestExchange")
.autoDelete()
.durable(true)
.internal()
.build();
}

@Bean
Exchange fanoutExchange(){
return ExchangeBuilder.fanoutExchange("FanoutTestExchange")
.autoDelete()
.durable(false)
.internal()
.build();
}

@Bean
Exchange headersExchange(){
return ExchangeBuilder.headersExchange("HeadersTestExchange")
.internal()
.durable(true)
.ignoreDeclarationExceptions()
.build();
}
}

0 comments on commit 6a02da5

Please sign in to comment.