rabbitmq / rabbitmq-objc-client

RabbitMQ client for Objective-C and Swift
https://rabbitmq.com
Other
241 stars 85 forks source link

Sending basic properties in basic publish #65

Closed sasikiran closed 8 years ago

sasikiran commented 8 years ago

In C#'s EasyNetQ RabbitMQ library, you can create MessageProperties object and configure custom userId, replyTo etc. and pass the properties in this.Bus.Publish() method.

Similarly, in Java's example shown in RPCClient.java, you see: channel.basicPublish("", requestQueueName, props, message.getBytes("UTF-8")) where props are the custom basic properties.

Lastly, in C library port, amqp_basic_publish() accepts the same custom properties in &properties.

How do I pass in the same basic properties in this library? I checked basicPublish method declared in RMQChannel, and it looks like the method doesn't seem to support properties parameter.

I also tried creating RMQBasicPublish object and then created RMQContentHeader with properties such as RMQBasicContentType, RMQBasicUserId, RMQBasicReplyTo etc.

However, I am stuck here not knowing what to do with the content header and how do I do a basic publish with the data I have. Any pointers here?

michaelklishin commented 8 years ago

Please post questions to rabbitmq-users or Stack Overflow. RabbitMQ uses GitHub issues for specific actionable items engineers can work on, not questions. Thank you.

michaelklishin commented 8 years ago

@sasikiran see https://github.com/rabbitmq/rabbitmq-objc-client/pull/64. In other words, without that PR there is no way to specify message properties. That's an overlooked feature in the library that will be addressed in the future.

camelpunch commented 8 years ago

Opening as a feature request in favour of #64

camelpunch commented 8 years ago

@sasikiran @hasbean with those three commits you can specify properties on a channel with basicPublish in a very manual way, by setting RMQBasic* types in an array, similar to PR #64 . I haven't yet implemented all of the encoding for every field type, though (including e.g. nested tables and nils), so you may run into issues when sending. I also haven't even looked at receiving properties through consumers.

The plan is to have RMQQueue and RMQExchange be the main interfaces for setting properties. They'll be settable through parameters with regular Objective-C / Swift types.

I'll be working on this until it's done, so tomorrow or Thursday might see this finished. Otherwise some time next week.

sasikiran commented 8 years ago

Thank you @camelpunch and @hasbean. I just checked out the API. This is so cool!