File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
java/fr/loicmathieu/bookmarkit Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 5151 <artifactId >quarkus-smallrye-metrics</artifactId >
5252 </dependency >
5353 <!-- Step 5 dependencies -->
54- <!-- <dependency> -- >
55- <!-- <groupId>io.quarkus</groupId> -- >
56- <!-- <artifactId>quarkus-smallrye-reactive-messaging-amqp</artifactId> -- >
57- <!-- </dependency> -- >
54+ <dependency >
55+ <groupId >io.quarkus</groupId >
56+ <artifactId >quarkus-smallrye-reactive-messaging-amqp</artifactId >
57+ </dependency >
5858 <!-- / Step 5 dependencies -->
5959 <!-- Step 6 dependencies -->
6060<!-- <dependency>-->
Original file line number Diff line number Diff line change 11package fr .loicmathieu .bookmarkit ;
22
3+ import io .smallrye .reactive .messaging .annotations .Emitter ;
4+ import io .smallrye .reactive .messaging .annotations .Stream ;
35import org .eclipse .microprofile .config .inject .ConfigProperty ;
46import org .eclipse .microprofile .metrics .annotation .Counted ;
57import org .eclipse .microprofile .metrics .annotation .Timed ;
68import org .eclipse .microprofile .openapi .annotations .Operation ;
9+ import org .eclipse .microprofile .reactive .messaging .Outgoing ;
710
811import javax .annotation .PostConstruct ;
12+ import javax .inject .Inject ;
913import javax .transaction .Transactional ;
1014import javax .ws .rs .Consumes ;
1115import javax .ws .rs .DELETE ;
2630public class BookmarkResource {
2731 @ ConfigProperty (name ="greeting" ) String greeting ;
2832
33+ @ Inject @ Stream ("bookmarks" ) Emitter <Bookmark > emitter ;
34+
2935 @ PostConstruct
3036 void init (){
3137 System .out .println ("Hello " + greeting );
@@ -55,6 +61,7 @@ public Bookmark get(@PathParam("id") Long id) {
5561 @ Timed (name ="create.time" )
5662 public Response create (Bookmark bookmark ){
5763 bookmark .persist ();
64+ emitter .send (bookmark );
5865 return Response .created (URI .create ("/bookmarks/" + bookmark .id )).build ();
5966 }
6067
Original file line number Diff line number Diff line change @@ -8,4 +8,12 @@ quarkus.datasource.password = connor
88quarkus.hibernate-orm.database.generation =drop-and-create
99
1010greeting =World
11- %dev.greeting =Dev
11+ %dev.greeting =Dev
12+
13+ # Configures the AMQP broker credentials.
14+ amqp-username =quarkus
15+ amqp-password =quarkus
16+ # Configure the AMQP connector to write to the `bookmark` address
17+ mp.messaging.outgoing.bookmarks.connector =smallrye-amqp
18+ mp.messaging.outgoing.bookmarks.address =bookmarks
19+ mp.messaging.outgoing.bookmarks.durable =true
You can’t perform that action at this time.
0 commit comments