Project: springxd
Issue XD-799: Change rabbitmq sink to use routing-key-expression instead of routing-key
The current rabbitmq sink uses the attribute routing-key, which defaults to the name of the stream. This should be change to use the attribute routing-key-expression so that the routing-key can be determined using SpEL. This will enable a dynamic evaluation of the routing-key based on message payload/header. *Implementation Suggestions* This hopefully should be changing the XML description of the sink to	routing-key-expression="${routingKey:'${xd.stream.name}'} This way, the ${xd.stream.name} is surrounded by a single quote to indicate a string literal to SpEL in the default case. *How to verify it works.* One of the simple uses of this is to create a routing key based on payload. In a distributed word-count example, the hashcode of a word would be sent to a certain number of processing modules that would perform the count. The idea is that the same word is sent to the same node over and over again, in particular if in-memory counters or state is computed - using centralized redis counters this wouldn't be necessary in the case of only counter state. The stream http | rabbit --routingKey="'word-' + payload.hashCode() % 3" is an example of a stream that can be used to verify that messages published to a direct exchange will have routing keys of the value word-0, word-1, and word-2. Binding a queue to each of these routing keys, one can observe the contents of messages in the queue to make sure that words are being routed to the appropriate queue, e.g. publishing "hello" as the payload of an http request should always appear in the same queue. The rabbitmq admin console can be used for this purpose.
Story points: 3