Is it possible to create a background service within Cuba that listens to/receives messages from a message broker like RabbitMQ ? I have been able to install RabbitMQ and send messages out with it, but I would like some sort of running background service which listens to incoming messages, and sends them to the right service. I lack a bit of experience in java, so if someone can help me in the right direction, I would be grateful.
Thanks allot! I’ve ran into the spring integration guide, but it was hard to follow as a non-experienced Java developer. (So initially I installed RabbitMQ in Cuba directly). Your explanation was perfect, so I remain without questions
I’ve read your blog a couple times as well, really good stuff (as far as I can follow) Specially the Lazy loading vs. eager fetching post with the Hobbits.
I’m starting with the implementation, and I’m running into a conversion issue. When I send a message to the queue in (via via rabbitMQ admin ui, and via an external console program), I get the following error:
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Failed to invoke target method 'receive' with argument type = [class [B], value = [{[B@3c07ac73}]
........
Caused by: java.lang.NoSuchMethodException: com.company.example.core.StatusUpdateReceiver.receive([B)
If I understand correctly, its seems that the default body it expects is a byte array. If I try to send the same messages to your project, I get the same errors. Perhaps within Spring, it defaults to a bytearray messages, but when I use another way of sending messages, it defaults to something else ?
It should be solvable by setting up a MessageConverter on the rabbitTemplate. But I’m a bit stuck how and if I should to implement it on the receiving end (in your case, in the BigOrderPresentCreator), of that it’s something I should add to the spring.xml configuration.