Azure/azure-event-hubs-node

Custom Filter

Closed this issue · 1 comments

https://github.com/Azure/azure-event-hubs-node/blob/master/send_receive/lib/client.js#L224

/**
 * Creates a receiver for the given event hub, consumer group, and partition.
 * Receivers are event emitters, watch for 'message' and 'errorReceived' events.
 *
 * @method createReceiver
 * @param {string} consumerGroup                      Consumer group from which to receive.
 * @param {(string|Number)} partitionId               Partition ID from which to receive.
 * @param {*} [options]                               Options for how you'd like to connect. Only one can be specified.
 * @param {(Date|Number)} options.startAfterTime      Only receive messages enqueued after the given time.
 * @param {string} options.startAfterOffset           Only receive messages after the given offset.
 * @param {string} options.customFilter               If you want more fine-grained control of the filtering.
 *      See https://github.com/Azure/amqpnetlite/wiki/Azure%20Service%20Bus%20Event%20Hubs for details.
 *
 * @return {Promise}
 */

See https://github.com/Azure/amqpnetlite/wiki/Azure%20Service%20Bus%20Event%20Hubs for details. Page 404.

and my question is i want to use filter to receive specific device's(like id: 'aaaa') messages

@willin - I dont think that there would be a need for customFilter anymore. We have made it easy by providing an option called eventPosition which takes an EventPosition object. This object has several helper methods to achieve what you want. You should still be able to provide a customFilter if required. Please try the new version and let us know if you still see issues. You can find examples over here.