Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscribe to MQ message with filter seem not works #523

Open
vdomos opened this issue Jul 26, 2017 · 0 comments
Open

Subscribe to MQ message with filter seem not works #523

vdomos opened this issue Jul 26, 2017 · 0 comments

Comments

@vdomos
Copy link
Contributor

vdomos commented Jul 26, 2017

In a plugin, if I subscribe to a particular MQ message like 'device-stats' in this plugin example:

self.log.info(u"==> Subscribe to MQ 'device-stats' messages") 
self.add_mq_sub("device-stats")

# -------------------------------------------------------------------------------------------------
def on_message(self, msgid, content):               
    ''' Receive 'device-stats' messages
        msgid = 'device-stats'
        content = {u'timestamp': 1500937509, u'sensor_id': u'210', u'device_id': 32, u'stored_value': u'10240971'}
    '''
    self.log.debug(u"Receive MQ '%s' message: %s" % (msgid, format(content)))
    if msgid == 'device-stats':
        ...

The on_message function will receive other messages too:

2017-07-26 10:58:56,944 domogik-flowmeter DEBUG Receive MQ 'device-stats' message: {u'timestamp': 1501059536, u'sensor_id': u'444', u'device_id': 84, u'stored_value': u'0.0'}
2017-07-26 10:58:57,055 domogik-flowmeter DEBUG Receive MQ 'device-stats' message: {u'timestamp': 1501059536, u'sensor_id': u'452', u'device_id': 89, u'stored_value': u'0.0'}
2017-07-26 10:59:02,869 domogik-flowmeter DEBUG Receive MQ 'device.update' message: {u'client_id': u'plugin-flowmeter.hades', u'device_id': u'86'}
2017-07-26 10:59:02,971 domogik-flowmeter DEBUG Receive MQ 'device.update' message: {u'client_id': u'plugin-flowmeter.hades', u'device_id': u'86'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant