yuuvis® Q&A

0 votes
in yuuvis Momentum by (2.4k points)

Hi Yuuvis Team

In my Microservice I am listening to a new AMQP Queue to process new documents. This basically works great, but when I look at the body of the message the Microservice receives, there are some weird characters before the JSON body starts. Do you know why I have this weird prefix? Do you suggest using something different from RabbitListener to listen to the Queue?

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-amqp</artifactId>
</dependency>

@RabbitListener(queues = "${yuuvis.queue.name:lc.processing}")
public void processMessage(Message message) {
  var mapper = new ObjectMapper();
  String body = new String(message.getBody());
  LOGGER.debug("Received messsage body: {}", body);
  var dmsObjects = mapper.readValue(body.substring(body.indexOf("{")), YuuvisResponse.class);
  ...

And the Log Outputs (not exact, some characters are not visible):
Received messsage body: Sw±¿{"objects":[{"properties":{"system:objectId":{"value":"66abc037-fb73-4854-9b3a-9df92f3dcc70"},"system:baseTypeId":{"value":"system:document"}...},"contentStreams":[{"contentStreamId":"BE22CB6A-9F51-11EA-9667-CDEE767074DA","length":19378,"mimeType":"image/tif","fileName":"test.tif","digest":"DDE1502E285351CDC06DC374EA88AA462468AD4BAD01484B7516AB7DE7B0D38C","repositoryId":"s3"}]}]}

Any ideas what could be causing this?

Kind regards
Nicole

1 Answer

0 votes
by (1.8k points)
Hi Nicole. this looks weird. Can you please check on the AMQP version used in the listener (yuuvis only supports 1.0)? And please also check object vs string serialization.
by (2.4k points)
I noticed that I already have the weird prefix when I use a tool to peek at the queue, such as: https://www.queueviewer.com/
So I don't think it's on my side.
...