File tree Expand file tree Collapse file tree 3 files changed +58
-19
lines changed
springwolf-examples/springwolf-amqp-example/src
main/java/io/github/stavshamir/springwolf/example Expand file tree Collapse file tree 3 files changed +58
-19
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,9 @@ public Queue anotherQueue() {
2626 return new Queue ("another-queue" , false );
2727 }
2828
29+ @ Bean
30+ public Queue exampleBindingsQueue () {
31+ return new Queue ("example-bindings-queue" , false );
32+ }
33+
2934}
Original file line number Diff line number Diff line change 44import io .github .stavshamir .springwolf .example .dtos .ExamplePayloadDto ;
55import org .slf4j .Logger ;
66import org .slf4j .LoggerFactory ;
7+ import org .springframework .amqp .core .ExchangeTypes ;
8+ import org .springframework .amqp .rabbit .annotation .Exchange ;
9+ import org .springframework .amqp .rabbit .annotation .Queue ;
10+ import org .springframework .amqp .rabbit .annotation .QueueBinding ;
711import org .springframework .amqp .rabbit .annotation .RabbitListener ;
812import org .springframework .stereotype .Service ;
913
@@ -22,4 +26,13 @@ public void receiveAnotherPayload(AnotherPayloadDto payload) {
2226 logger .info ("Received new message in another-queue: {}" , payload .toString ());
2327 }
2428
29+ @ RabbitListener (bindings = {
30+ @ QueueBinding (
31+ exchange = @ Exchange (name = "name" , type = ExchangeTypes .TOPIC ),
32+ value = @ Queue (name = "example-bindings-queue" ))
33+ })
34+ public void bindingsExample (AnotherPayloadDto payload ) {
35+ logger .info ("Received new message in example-bindings-queue: {}" , payload .toString ());
36+ }
37+
2538}
Original file line number Diff line number Diff line change 1212 }
1313 },
1414 "channels" : {
15+ "example-bindings-queue" : {
16+ "publish" : {
17+ "bindings" : {
18+ "amqp" : {
19+ "expiration" : 0 ,
20+ "priority" : 0 ,
21+ "deliveryMode" : 0 ,
22+ "mandatory" : false ,
23+ "timestamp" : false ,
24+ "ack" : false
25+ }
26+ },
27+ "message" : {
28+ "name" : " io.github.stavshamir.springwolf.example.dtos.AnotherPayloadDto" ,
29+ "title" : " AnotherPayloadDto" ,
30+ "payload" : {
31+ "$ref" : " #/components/schemas/AnotherPayloadDto"
32+ }
33+ }
34+ }
35+ },
1536 "another-queue" : {
1637 "publish" : {
1738 "bindings" : {
5778 },
5879 "components" : {
5980 "schemas" : {
81+ "AnotherPayloadDto" : {
82+ "type" : " object" ,
83+ "properties" : {
84+ "foo" : {
85+ "type" : " string"
86+ },
87+ "example" : {
88+ "$ref" : " #/components/schemas/ExamplePayloadDto"
89+ }
90+ },
91+ "example" : {
92+ "foo" : " string" ,
93+ "example" : {
94+ "someString" : " string" ,
95+ "someLong" : 0 ,
96+ "someEnum" : " FOO1"
97+ }
98+ }
99+ },
60100 "ExamplePayloadDto" : {
61101 "type" : " object" ,
62102 "properties" : {
81121 "someLong" : 0 ,
82122 "someEnum" : " FOO1"
83123 }
84- },
85- "AnotherPayloadDto" : {
86- "type" : " object" ,
87- "properties" : {
88- "foo" : {
89- "type" : " string"
90- },
91- "example" : {
92- "$ref" : " #/components/schemas/ExamplePayloadDto"
93- }
94- },
95- "example" : {
96- "foo" : " string" ,
97- "example" : {
98- "someString" : " string" ,
99- "someLong" : 0 ,
100- "someEnum" : " FOO1"
101- }
102- }
103124 }
104125 }
105126 }
You can’t perform that action at this time.
0 commit comments