RabbitMQ Streams - problem with sending messages

205 views
Skip to first unread message

Adam_APH

unread,
Aug 6, 2022, 6:40:17 PM8/6/22
to rabbitmq-users
Hi everyone,

I'm stuck with testing RabbitMQ Streams with Java client, so perhaps some expert here can point me to the right direction... :)

So I have simple SpringBoot app which on the one hand uses Debezium to read events from Postgress DB and then tries to send these messages to RMQ Stream. Mostly I'm following the official example for Java client. So the code seems to properly instantiate connection to RMQ cluster, then creates the stream and the producer. I can see empty stream like that:
z1.jpg
But when I try to post messages with publishsingId it fails with exception: java.lang.IllegalStateException: The producer has no connection at the line where I'm trying to get the previous Id: nextPublishingId = producer.getLastPublishingId() + 1; , here is the code snippet:
z2.jpg
 
and here is how I initialize all of it:
z3.jpg
I'm using RabbitMQ 3.10 and Java Client 0.6.0.
Perhaps I'm missing something. Even if I remove getLastPublishingId() then send shows no errors, but these sent messages are not confirmed and when checking the stream it remains empty, so somehow my messages are not received by the cluster.
Any hints are appreciated!

Arnaud Cogoluègnes

unread,
Aug 8, 2022, 2:43:39 AM8/8/22
to rabbitmq-users
The code looks correct. Could you enable "debug" logging level for the com.rabbitmq.stream logger on the client side and share the server logs?

Thanks.

Adam_APH

unread,
Aug 8, 2022, 3:51:45 AM8/8/22
to rabbitmq-users
Thanks for the quick response :)

I enabled debug for the client App and for the RMQ server, posted it here: https://filebin.net/des1osxlq2cus7gm

Thanks,
Adam

Adam_APH

unread,
Aug 8, 2022, 4:08:45 AM8/8/22
to rabbitmq-users
Here with less noise:  https://pastebin.com/5beV6C0m

Arnaud Cogoluègnes

unread,
Aug 8, 2022, 6:02:34 AM8/8/22
to rabbitmq-users
The code is not correct actually :-)  You use a try-with-resources block to create the environment, so you close it at the end of the block, which closes also the publisher. Sorry for missing this first!

Adam_APH

unread,
Aug 8, 2022, 6:10:07 AM8/8/22
to rabbitmq-users
Aaah, good catch! :)

It works now. One more question: would you consider Java Client 0.6.0 as production ready, or should I better wait till 1.x.x?

Regards,
Adam

Arnaud Cogoluègnes

unread,
Aug 8, 2022, 9:12:36 AM8/8/22
to rabbitmq-users
We don't have an ETA for stream Java client 1.0.0; it should not be released in the next few months. The documentation has a couple of notes on the stability of the API [1] [2]. So I would recommend using it as it is now if it's a good fit for your use case.

As for "production ready" for streams in general, it's a pretty young feature (about 1 year), we've been stabilizing it, so it should be OK for most applications but I would not recommend it yet for critical systems (defense, space, etc). Criticality is subjective though :-)

Adam_APH

unread,
Aug 8, 2022, 9:36:03 AM8/8/22
to rabbitmq-users
Cool, thanks a lot for your help! :)

/Adam

Reply all
Reply to author
Forward
0 new messages