Hi experts,
I am quite new to crossbar so forgive me for the naive question. I have recently noticed a misbehaviour of my application which crossbar-wise is quite simple:
1. at the beginning I subscribe to many topics at once
2. as soon as one of the topic is updated, I perform some calculation based on the number I received.
3. independently (in a second application) the same topics are subscribed in order store them in a DB.
Unfortunately I have discovered that sometimes my first app, the one that does the calculations, doesn't receive the updates (I checked that the publication of the updated values is succesful looking at the values stored in the DB by the second app). Looking at the code I started wondering if something may be wrong with the subscription to the topic.
So here my two questions:
- first of all is it reasonable to assume that sometimes a subscription may fail ? (it seems to me such a simple operation that I am not sure how it could fail)
- which is the Deferred value returned by the "subscribe" statement in case of a failure ?
Below few lines of code I wrote for testing where I am not sure if it is enough to check result.active to say the subscription was OK:
def printData(self, result):
if (result.active):
print ("Subscription OK")
else:
print ("Subscription failed")
def eventLoop(self):
for t in topics:
mysubs = self.subscribe(handler, t, options=SubscribeOprions(details_arg="details"))
mysub.addCallback(self.printData)
Thank you in advance.
Best regards,
Matteo.