You can use an embedded Camel route to consume messages from an input queue and publish them to the topic to which you want the message published. Camel also allows you to transform the body of the message, eliminating any portions you no longer need if they were present only for routing to the right topic.
With that being said, in its default configuration ActiveMQ creates destinations on demand as they're used by a client, so creating the topic automatically (if needed) by simply publishing to it in client code *is* practical for a real-time system. But the embedded Camel route will work too, it's just more complex and it's not what I'd choose if it was me. On Wed, Mar 2, 2016 at 11:47 AM, [email protected] <[email protected]> wrote: > Does ActiveMQ support dynamic topic creation? For example, can I define a > topic template as x.y.z. > If the message has content like x=price, y=bond, z=5Y, price=99.25, it > means > the topic will end up as price.bond.5Y and the message we published will be > price=99.25. > > It defines topic as template which has variable names. Then the message > body > will have the corresponding values for those variables. Basically, I don't > now how many topics will be needed but I know it will be corresponding to > the messages we will publish. > > I feel predefine a set of fixed topics and limit us to that set is not > dynamic enough. What if y is an instrument ID which I have no idea until > the > moment the data becomes available. I have to create a topic and then > publish the data? It is not that practical for a real time system. > > I am new to ActiveMQ and trying to understand how it works. If you know how > this can be done in ActiveMQ, please help. Thanks. > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/identify-the-topic-basing-on-message-content-tp4708820.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. >
