kohesive / vertx-sqs

Amazon SQS Client for Vert.x
MIT License
13 stars 13 forks source link

Groovy client - sendMessage - error #1

Open leosilvadev opened 8 years ago

leosilvadev commented 8 years ago

Using the groovy client we face an error:

java.lang.ClassCastException: io.vertx.core.json.JsonObject cannot be cast to java.lang.String
    at org.collokia.vertx.sqs.SqsQueueProducerVerticle$start$1$replyHandler$1.handle(SqsQueueProducerVerticle.kt:33)
    at org.collokia.vertx.sqs.SqsQueueProducerVerticle$start$1$replyHandler$1.handle(SqsQueueProducerVerticle.kt:12)
    at io.vertx.core.eventbus.impl.HandlerRegistration.handleMessage(HandlerRegistration.java:207)
    at io.vertx.core.eventbus.impl.HandlerRegistration.handle(HandlerRegistration.java:201)
    at io.vertx.core.eventbus.impl.EventBusImpl.lambda$deliverToHandler$123(EventBusImpl.java:498)
    at io.vertx.core.eventbus.impl.EventBusImpl$$Lambda$31/378789212.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$wrapTask$16(ContextImpl.java:335)
    at io.vertx.core.impl.ContextImpl$$Lambda$7/245765246.run(Unknown Source)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
    at java.lang.Thread.run(Thread.java:745)

I 'fixed' that here, but it's probably not a real fixing (I change the Message to Message at SqsQueueProducerVerticle.kt:33

apatrida commented 8 years ago

thanks, we'll fix it here, and also build this to maven central soon.

leosilvadev commented 8 years ago

Great! thanks!

brainoutsource commented 8 years ago

That's not an error, it's just that we expect String message body, not JsonObject. Write your json as a String, you can use JsonObject().encode() ot JsonObject.toString() for that.

I should probably write about that in the readme file.

leosilvadev commented 8 years ago

Yeah, it really doesn't make sense, but the error happens even when I try to call this:

client.sendMessage('Authorizations', 'anystring', {
    println it.result()
})

I am not with my notebook now, but asap I will check the groovy generated code, but probably it's wrapping the messaging in a JsonObject (since I got something like this using a different codec)

apatrida commented 6 years ago

We could add an override for JsonObject