File tree Expand file tree Collapse file tree 4 files changed +19
-16
lines changed
springwolf-examples/springwolf-amqp-example/src
main/java/io/github/stavshamir/springwolf/example/amqp Expand file tree Collapse file tree 4 files changed +19
-16
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import io .github .stavshamir .springwolf .example .amqp .dtos .AnotherPayloadDto ;
5
5
import io .github .stavshamir .springwolf .example .amqp .dtos .ExamplePayloadDto ;
6
- import io .github .stavshamir .springwolf .example .amqp .producers .ExampleProducer ;
6
+ import io .github .stavshamir .springwolf .example .amqp .producers .AnotherProducer ;
7
7
import lombok .RequiredArgsConstructor ;
8
8
import lombok .extern .slf4j .Slf4j ;
9
9
import org .springframework .amqp .core .ExchangeTypes ;
18
18
@ RequiredArgsConstructor
19
19
public class ExampleConsumer {
20
20
21
- private final ExampleProducer exampleProducer ;
21
+ private final AnotherProducer anotherProducer ;
22
22
23
23
@ RabbitListener (queues = "example-queue" )
24
24
public void receiveExamplePayload (ExamplePayloadDto payload ) {
25
25
log .info ("Received new message in example-queue: {}" , payload .toString ());
26
- exampleProducer .sendMessage (payload );
26
+
27
+ AnotherPayloadDto example = new AnotherPayloadDto ();
28
+ example .setExample (payload );
29
+ example .setFoo ("foo" );
30
+
31
+ anotherProducer .sendMessage (example );
27
32
}
28
33
29
34
@ RabbitListener (queues = "another-queue" )
Original file line number Diff line number Diff line change 5
5
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .AsyncOperation ;
6
6
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .AsyncPublisher ;
7
7
import io .github .stavshamir .springwolf .example .amqp .dtos .AnotherPayloadDto ;
8
- import io .github .stavshamir .springwolf .example .amqp .dtos .ExamplePayloadDto ;
9
8
import lombok .RequiredArgsConstructor ;
10
9
import org .springframework .amqp .rabbit .core .RabbitTemplate ;
11
10
import org .springframework .stereotype .Component ;
12
11
13
12
@ Component
14
13
@ RequiredArgsConstructor
15
- public class ExampleProducer {
14
+ public class AnotherProducer {
16
15
private final RabbitTemplate rabbitTemplate ;
17
16
18
17
@ AsyncPublisher (
@@ -21,9 +20,8 @@ public class ExampleProducer {
21
20
channelName = "example-producer-channel-publisher" ,
22
21
description = "Custom, optional description defined in the AsyncPublisher annotation" ))
23
22
@ AmqpAsyncOperationBinding ()
24
- public void sendMessage (ExamplePayloadDto msg ) {
23
+ public void sendMessage (AnotherPayloadDto msg ) {
25
24
// send
26
- AnotherPayloadDto dto = new AnotherPayloadDto ("fooValue" , msg );
27
- rabbitTemplate .convertAndSend ("example-topic-exchange" , "example-topic-routing-key" , dto );
25
+ rabbitTemplate .convertAndSend ("example-topic-exchange" , "example-topic-routing-key" , msg );
28
26
}
29
27
}
Original file line number Diff line number Diff line change 174
174
},
175
175
"message" : {
176
176
"schemaFormat" : " application/vnd.oai.openapi+json;version=3.0.0" ,
177
- "name" : " io.github.stavshamir.springwolf.example.amqp.dtos.ExamplePayloadDto " ,
178
- "title" : " ExamplePayloadDto " ,
179
- "description" : " Example payload model" ,
177
+ "name" : " io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto " ,
178
+ "title" : " AnotherPayloadDto " ,
179
+ "description" : " Another payload model" ,
180
180
"payload" : {
181
- "$ref" : " #/components/schemas/io.github.stavshamir.springwolf.example.amqp.dtos.ExamplePayloadDto "
181
+ "$ref" : " #/components/schemas/io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto "
182
182
},
183
183
"headers" : {
184
184
"$ref" : " #/components/schemas/HeadersNotDocumented"
Original file line number Diff line number Diff line change 92
92
},
93
93
"message" : {
94
94
"schemaFormat" : " application/vnd.oai.openapi+json;version=3.0.0" ,
95
- "name" : " io.github.stavshamir.springwolf.example.amqp.dtos.ExamplePayloadDto " ,
96
- "title" : " ExamplePayloadDto " ,
97
- "description" : " Example payload model" ,
95
+ "name" : " io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto " ,
96
+ "title" : " AnotherPayloadDto " ,
97
+ "description" : " Another payload model" ,
98
98
"payload" : {
99
- "$ref" : " #/components/schemas/io.github.stavshamir.springwolf.example.amqp.dtos.ExamplePayloadDto "
99
+ "$ref" : " #/components/schemas/io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto "
100
100
},
101
101
"headers" : {
102
102
"$ref" : " #/components/schemas/HeadersNotDocumented"
You can’t perform that action at this time.
0 commit comments