-
1. Re: Durable topic configuration
jbertram Jul 29, 2015 11:09 PM (in response to wterry)The documentation you linked provides an example for topic:
<jms-destinations>
<jms-topic name="testTopic">
<entry name="jms/topic/test"/>
<entry name="java:jboss/exported/jms/topic/test"/>
</jms-topic>
</jms-destinations>
A topic configured via XML such as this will persist between server restarts (unless you remove it). Whether or not messages persist between server restarts is based on what kind of messages you're sending (persistent or non-persistent) and the kind of subscription(s) your clients use (durable or non-durable). The JMS API has options for each use case. It's worth noting that the semantics of a topic dictate that messages are only delivered to an applicable subscription so if no subscription exists on the topic and you send a message to it then the message is simply discarded.
As far as creating topics dynamically, it's not clear to me whether you actually want to create the actual topic dynamically or the subscription dynamically. Can you clarify this point?
-
2. Re: Durable topic configuration
wterry Jul 30, 2015 12:42 PM (in response to jbertram)Well it seems that I was laboring under a misunderstanding then.
If the topic itself doesn't have to be marked either persistent or durable because such things are handled with the messages, I should still need to configure the suscriptions (that is, users and passwords) somewere either in the topic or the connection factory so that the actual suscribers can access the messages, right?
Then, the message producer somehow marks the messages it posts to the topic as both persistent and durable at the time it sends them to the topic and the topic itself does the rest, if I'm understanding right. This is done just with JMS then, no need to tinker with the Jboss config?
As far as what I need to create dynamically I think I was wrong there too, on account of my not understanding how persistence and durability are handled. The basic requirement I have is that I need to create chat rooms, for which I'm using topics; the problem is that the rooms themselves have to be created on the fly for an unknown number of participants. The rooms have to be independent from each other and the messages in each room have to persist through server restarts and old messages need to be pushed to new suscribers as they arrive.
I thought that making a durable topic (or suscription as the case seems to be) would be the solution, but the fact that I dont know how many topic I'd have to create and how many suscribers to allow means that I need to create the whole thing dynamically, for which I found this reference to the management API: The native management API - WildFly 8 - Project Documentation Editor and this short example that I'll try to adapt for the creation of JMS resources: http://www.mastertheboss.com/jboss-server/jboss-as-7/using-jboss-management-api-programmatically
However, before I tackle all that at the end, I'm trying to understand how to set up the scenario for a single topic with several suscribers via the configuration just so I know what I'll be trying to build with the API.
Thanks for your help and taking an interest in my question!
-
3. Re: Durable topic configuration
jbertram Jul 30, 2015 1:27 PM (in response to wterry)If the topic itself doesn't have to be marked either persistent or durable because such things are handled with the messages, I should still need to configure the suscriptions (that is, users and passwords) somewere either in the topic or the connection factory so that the actual suscribers can access the messages, right?
To be clear, persistent and durable in my experience are the same thing so marking something as either persistent or durable should accomplish the same thing. In JMS, messages are typically referred to as either persistent and non-persistent and subscriptions are referred to as either durable or non-durable. I'm not sure why the nomenclature is different because in both cases it refers to the object's ability to survive a server crash/restart.
As far as configuring the subscriptions themselves, that is up to the clients. They would use the JMS API to create their subscription (either durable or not).
If you need to configure users and passwords that would be done at the broker/server using a security-domain configuration of your choosing (for authentication) as well as the security-settings element in <hornetq-server> (for authorization).
Then, the message producer somehow marks the messages it posts to the topic as both persistent and durable at the time it sends them to the topic and the topic itself does the rest, if I'm understanding right. This is done just with JMS then, no need to tinker with the Jboss config?
That's correct. Clients mark messages as either persistent or non-persistent using the JMS API when the message is sent. Again, in this situation persistent and durable are functionally equivalent, but the JMS API uses persistent in reference to messages.