1
votes

I'm new to Spring, Spring Boot and RabbitMQ. However I'm an okay programmer/problem solver.

Recently I started go through this book Learning Spring Boot 2.0 - Second Edition, code for this can be found here https://github.com/learning-spring-boot/learning-spring-boot-2nd-edition-code. I think that things were moving along okay for me...a few hiccups here and there, but whatever as long as I was able to progress and learn I figured I was doing fine.

I'm just over half way through this book and then the author starts talking about Spring Cloud Streams and RabbitMQ. I'm now working with the code found here https://github.com/learning-spring-boot/learning-spring-boot-2nd-edition-code/tree/master/6/part3.

My code doesn't produce an error, but it doesn't produce the expected results either. When I run the application the image comments do not seem to be saved or shown. I get a log message like this

o.s.a.r.c.CachingConnectionFactory : Created new connection: SpringAMQP#2920fd66:0/SimpleConnection@59ae4da8 [delegate=amqp://[email protected]:5672/, localPort= 57615]

when I submit the data.

However the book states that I should get getting messages like the following:

o.s.integration.channel.DirectChannel : preSent on channel input, message: GenericMessage [payload=Comment(id=null,imageId=book.jpg)]

Looking at what I should be getting it appears as thought the problem may be related to channels. Maybe the issue is not channels, maybe it's something else.

How should I go about finding the exact cause of this of the problem?

1

1 Answers

0
votes

I am not familiar with Greg's book but I just loaded that app into eclipse and it seems to work fine for me. After uploading an image it shows up in the list.

I then comment on the image and I see...

2018-01-19 00:04:41.046 DEBUG 16612 --- [ctor-http-nio-3] o.s.integration.channel.DirectChannel : preSend on channel 'output', message: GenericMessage [payload=com.greglturnquist.learningspringboot.comments.Comment@4d4f990f, headers={id=0651f9b9-e38b-1557-67dd-bc19acae8af1, timestamp=1516338281044}]

...

2018-01-19 00:07:35.570 DEBUG 17539 --- [g-spring-boot-1] o.s.integration.channel.DirectChannel : preSend on channel 'input', message: GenericMessage [payload=byte[64], headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=learning-spring-boot-comments, amqp_receivedExchange=learning-spring-boot-comments, amqp_deliveryTag=1, amqp_consumerQueue=learning-spring-boot-comments.learning-spring-boot, amqp_redelivered=false, id=43094b53-d9b5-115e-db44-dcef73a0a9c4, amqp_consumerTag=amq.ctag-MGTGY6EuPidJy3BH7_j2zw, contentType=application/json, timestamp=1516338455570}]

But I do see

2018-01-19 00:07:54.291 ERROR 17539 --- [ctor-http-nio-3] o.s.w.s.h.ResponseStatusExceptionHandler : Response status 405 with reason "Request method 'GET' not supported"

I am not sure if you are supposed to see comments that were posted.

How should I go about finding the exact cause of this of the problem?

First step would be to enable DEBUG logging for the root logger (or all of org.springframework).

You might want to reach out to Greg on his web site.