Skip to content

Commit 65e6915

Browse files
committed
Fix ConfirmConsumerTest
1 parent b031133 commit 65e6915

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/test/kotlin/com/viartemev/thewhiterabbit/consumer/ConfirmConsumerTest.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package com.viartemev.thewhiterabbit.consumer
22

33
import com.rabbitmq.client.ConnectionFactory
44
import 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
67
import com.viartemev.thewhiterabbit.queue.QueueSpecification
78
import com.viartemev.thewhiterabbit.queue.declareQueue
89
import 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
}

0 commit comments

Comments
 (0)