File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
src/test/kotlin/com/viartemev/thewhiterabbit/consumer Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ package com.viartemev.thewhiterabbit.consumer
22
33import com.rabbitmq.client.ConnectionFactory
44import com.rabbitmq.client.Delivery
5- import com.viartemev.thewhiterabbit.channel.consumer
5+ import com.viartemev.thewhiterabbit.channel.channel
6+ import com.viartemev.thewhiterabbit.channel.consume
67import com.viartemev.thewhiterabbit.queue.QueueSpecification
78import com.viartemev.thewhiterabbit.queue.declareQueue
89import kotlinx.coroutines.delay
@@ -29,11 +30,12 @@ class ConfirmConsumerTest {
2930 @Test
3031 fun `test message consuming` () {
3132 factory.newConnection().use { connection ->
32- connection.createChannel().use { channel ->
33- runBlocking {
34- channel.declareQueue(QueueSpecification (QUEUE_NAME ))
35- val consumer = channel.consumer(QUEUE_NAME )
36- for (i in 1 .. 3 ) consumer.consumeWithConfirm({ handleDelivery(it) })
33+ runBlocking {
34+ connection.channel {
35+ declareQueue(QueueSpecification (QUEUE_NAME ))
36+ consume(QUEUE_NAME ) {
37+ for (i in 1 .. 3 ) consumeWithConfirm({ handleDelivery(it) })
38+ }
3739 }
3840 }
3941 }
You can’t perform that action at this time.
0 commit comments