You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Migration-5-6.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,14 @@ Changes in Scala API:
11
11
1. The whole API is _finally tagless_ - all methods return `F[_]`. See [related section](README.md#scala-usage) in docs.
12
12
1. The API now uses type-conversions - provide type and related converter when creating producer/consumer.
13
13
See [related section](README.md#providing-converters-for-producer/consumer) in docs.
14
-
1. The `Delivery` is now generic - e.g. `Delivery[Bytes]` (depends on type-conversion).
14
+
1. The `Delivery` is now sealed trait - there are `Delivery.Ok[A]` (e.g. `Delivery[Bytes]`, depends on type-conversion) and `Delivery.MalformedContent`.
15
+
After getting the `Delivery[A]` you should pattern-match it.
15
16
1. The API now requires an implicit `monix.execution.Scheduler` instead of `ExecutionContext`.
16
17
1. Methods like `RabbitMQConnection.declareQueue` now return `F[Unit]` (was `Try[Done]` before).
17
18
1. Possibility to pass manually created configurations (`ProducerConfig` etc.) is now gone. The only option is to use TypeSafe config.
18
19
1. There is no `RabbitMQConsumer.bindTo` method anymore. Use [additional declarations](README.md#additional-declarations-and-bindings) for such thing.
19
20
1. There are new methods in [`RabbitMQConnection`](core/src/main/scala/com/avast/clients/rabbitmq/RabbitMQConnection.scala): `newChannel` and `withChannel`.
21
+
1.[`RabbitMQPullConsumer`](README.md#pull-consumer) was added
20
22
21
23
Changes in Java API:
22
24
@@ -27,3 +29,4 @@ Changes in Java API:
27
29
1. Method `RabbitMQProducer.send` now returns `CompletableFuture[Void]` (was `void` before) - ***it's not blocking anymore!***
28
30
1.`RabbitMQConsumer` and `RabbitMQProducer` (`api` module) are now traits and have their `Default*` counterparts in `core` module
29
31
1. There is no `RabbitMQConsumer.bindTo` method anymore. Use [additional declarations](README.md#additional-declarations-and-bindings) for such thing.
The Java API has some limitations compared to the Scala one - mainly it does not support [types conversions](#providing-converters-for-producer/consumer)
303
+
and it offers only asynchronous version with `CompletableFuture` as result of all operations.
304
+
298
305
See [full example](core/src/test/java/ExampleJava.java)
299
306
300
307
## Notes
@@ -360,7 +367,12 @@ Check [reference.conf](core/src/main/resources/reference.conf) for all options o
360
367
Sometimes your use-case just doesn't fit the _normal_ consumer scenario. Here you can use the _pull consumer_ which gives you much more
361
368
control over the received messages. You _pull_ new message from the queue and acknowledge (reject, ...) it somewhere in the future.
362
369
363
-
The pull consumer operates with `Option` which is used for expressing either getting the delivery _or_ detecting an empty queue.
370
+
The pull consumer uses `PullResult` as return type:
371
+
* Ok - contains `DeliveryWithHandle` instance
372
+
* EmptyQueue - there was no message in the queue available
373
+
374
+
Additionally you can call `.toOption` method on the `PullResult`.
375
+
364
376
365
377
A simplified example:
366
378
```scala
@@ -377,14 +389,14 @@ val consumer = connection.newPullConsumer[Bytes](???, ???)
377
389
378
390
379
391
// receive "up to" 100 deliveries
380
-
valdeliveries:Future[Seq[Option[DeliveryWithHandle[Future, Bytes]]]] =Future.sequence { (1 to 100).map(_ => consumer.pull()) }
392
+
valdeliveries:Future[Seq[PullResult[Future, Bytes]]] =Future.sequence { (1 to 100).map(_ => consumer.pull()) }
0 commit comments