I'm trying to architect my app to use BroadcastOutputAdapter.
I'd like to use compound keys to be able to identify events based on timestamp and a custom property. I'm also trying to use monotonic approach as my key is based on a timestamp and have only a custom value to differentiate one from the other (like the accountId sample from the cep developer guide).
However, when implementing the key based on the "Example 21–25" of CEP Dev Guide, I got an error saying my compound key class must implement Comparable.
That's where my doubt is: how can I implement comparable and still take into account the custom property in the comparison as the comparable is just about bigger, smaller, and equal? Seems that if I use only the timestamp value, my custom property would be ingored and I would compare just based on the timestamp and I could end up comparing timestamp from key of accountId = A with timestamp from key of accountid = B.
The point is that I may have the following events being output:
In this case, I'm interested in all messages for A and B however, seems to me (please, correct me if I'm wrong) that if I compare only the timestamp, I'll consider timestamps 7 and 8 to be smaller than the timestamps 9 and 10, however they are output for different IDs and the events for ID B would be pruned and I can't afford that.
Am I right?
I see. This involves partition in comparing. But it's not supported in HA adapter. If it's important for you, please file a request.
One workaround is, you can use two queries + two HA output adapters. One query for A and One for B.