-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not a valid type: “x” with byte array element in Headers #58
Comments
First of all, there are no byte arrays in Ruby. Rather, Ruby values are strings that are passed around as byte arrays. So that part is supported in the most straightforward way possible. You are not providing any code examples but the issue can be value-specific. Please post a code sample we can run to reproduce. |
Oh, and knowing what exact version of both gems you use would be useful, too. |
A quick glance at value encoder, value decoder, and table type constants suggests that the payload comes from a different client. So what client is that? |
Here is the code: Attached file has more info.. Versions: amq-protocol (2.0.0, 1.9.2) I have attached a sample message from my queue... |
The above code snippet worked fine with simple queue which did not have Actual-Record element. However with actual record header is processed till channel type and then raise exception... i.e.
|
@mohitjagga this is the code you consume with. What code publishes messages? |
@michaelklishin that code is springXD code. Developed by the Java developers and I am consuming the streams created by their modules by creating taps on streams. |
@mohitjagga alright. Last question: what do you expect to come out on the Ruby end where Java publishers use byte arrays? Ruby doesn't have byte arrays. |
@michaelklishin Correct me if I am wrong... You are saying there is no concept of byte array in Ruby and Ruby will not handle it. However I am using queue.pop(payload)... I want some way I can fetch payload without even bother about headers. What is happening => it inspect headers and throws exception. Is it possible to fetch payload in this scenario where we have byte array in header... as of now all amqp methods fails with same error and I am stuck with as even though I do not need headers... |
There is no data structure for byte and byte array the same way they are in Java. Byte arrays can be turned into strings in Ruby land. The question is what most Ruby users would expect. You can't consume a message without consuming (and parsing) its headers. |
Thanks a lot for your help... I will see if I can use Java for this |
Hold on. There is a missing deserialisation feature in this library: most people never hit it because many popular programming languages don't operate byte buffers, and thus don't pass them around, or at least not in headers. I gather the best way to treat byte buffers in Ruby would be to turn them into strings in binary encoding. |
I am sure Ruby users will need some other way to handle byte array. Converting into string will increase the size of header. We are using byte array as size of actual-record header is big and string cannot handle that. |
@michaelklishin that would be awesome :-) |
Most Ruby users wouldn't even say with confidence what a byte array is. I'm going to add byte array deserialisation that produces strings (much like message bodies are strings, even though they really are byte streams, and |
I guess the only issue is if the ruby app publishes a reply, echoing the headers, the Java app would see the echoed header as a But I see there's not really much that can be done about that. |
@mohitjagga please try with |
@michaelklishin It worked like a charm. We are doing the same in out app.. byte array is just for transfer data and then we convert it to string.. byte array helps in transporting heavy data which string cant :-).. Thanks a lot for your help! PS: Any idea when this fix will be available in rubygems.org? |
It already is. |
## Changes between 2.0.0 and 2.1.0 ### Ruby Warnings Squashed Contributed by Akira Matsuda. GitHub issue: [#62](ruby-amqp/amq-protocol#62) ### Byte Array Decoding Byte array values in types now can be decoded (to the extent Ruby type system permits) by this library. GitHub issue: [#58](ruby-amqp/amq-protocol#58)
I am trying to fetch messages from queue using ruby amqp gems and getting error.
I have one byte array in header (i.e. actual record) which is must from development prospective and type cannot be changed. I have tried
but same error in both issues. I found amqp protocol -> table raise this exception. The byte array type (header) should be supported as rabittMQ supports it.
Here is the error
The text was updated successfully, but these errors were encountered: