[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xmlblaster] Publish/Topic clobbering with multiple clients



I have identical clients connecting to xmlBlaster to exchange messages.
However, with only rudimentary understanding of the protocol and API, I'm
trampling a Topic in my init code somehow.  Meaning, when I launch one
client, I subscribe to an oid, then set up what's needed to publish via that
same oid and then set the topic properties.  Then when I launch the second
client (which executes all the same code), it somehow overwrites the topic
(or publish chanel, not sure of the terminology used) in some way so that
updates only work when sent from the one that was launched second.

I'm thinking I should be checking to see if the topic already exists
somehow?  That I should be asking for the subscribe object from the server?
I dug through the API, but kind of wound up at dead-ends :(

Setup code:

            con = new XmlBlasterConnection(glob);

            qos = new ConnectQos(glob);
            crq = con.connect(qos, this);  // Login to xmlBlaster, register
for updates

            sk = (oid.length() > 0) ? new SubscribeKey(glob, oid) : new
SubscribeKey(glob, xpath, Constants.XPATH);
            sq = new SubscribeQos(glob);
            sq.setWantInitialUpdate(true);
            sq.setWantLocal(false);
            sq.setWantContent(true);

            HistoryQos historyQos = new HistoryQos(glob);
            historyQos.setNumEntries(historyNumUpdates);
            sq.setHistoryQos(historyQos);

            SubscribeReturnQos srq = con.subscribe(sk.toXml(), sq.toXml());

            pk = new PublishKey(glob, oid, "text/xml", "1.0");
            pk.setClientTags("<MyCompany><ProductName/></MyCompany>");
            
            pq = new PublishQos(glob);
            pq.setPriority( PriorityEnum.NORM_PRIORITY );
            pq.setPersistent( false );
            pq.setLifeTime( -1L );
            pq.setSubscribeable( true );

            topicProperty = new TopicProperty(glob);
            topicProperty.setDestroyDelay(60000L);
            topicProperty.setCreateDomEntry(true);
            topicProperty.setReadonly(false);
            pq.setTopicProperty(topicProperty);