Logging Messages

#1

Hello

There is any easy way to log every messages passing through the router? I want to make something like a “transactions history”. I could just create a component subscribed to every topic and log the message content, but how would I know the topic of that message to save it as well?

My goal is to create a queue as a messages buffer, then if a faulty component needs to process some messages it missed, then I could just make a dedicated queue with those messages.

Thanks

Johnny W. Santos

0 Likes

#2

As far as I understand WAMP, you should never implement application-specific code on the Router. Routers should be completely generic exchangeable black boxes, so it could not do the logging for your application domain.

With that in mind you could implement a Callee WAMP component that would do the logging, and all your other components would call this Logging component before Pub, Sub, Call and Execute.

Att,

Pedro Peixoto.

···

Em quarta-feira, 29 de julho de 2015 10:09:29 UTC-3, Johnny W. Santos escreveu:

Hello

There is any easy way to log every messages passing through the router? I want to make something like a “transactions history”. I could just create a component subscribed to every topic and log the message content, but how would I know the topic of that message to save it as well?

My goal is to create a queue as a messages buffer, then if a faulty component needs to process some messages it missed, then I could just make a dedicated queue with those messages.

Thanks

Johnny W. Santos

0 Likes

#3

Sorry Pedro for responding again, but I sent the email just to you in the first time…

Actually you can define components to run side-by-side in the same router process, as you can see here http://crossbar.io/docs/Router-Components/ .
But in my case it could be a client, not even running on the same machine, subscribed with a wildcard to get every messages, but also identify the specific topic from a message.

Anybody know if there is a option to pass something more then just the message payload when I subscribe a callback to a topic?

···

Em quarta-feira, 29 de julho de 2015 12:46:49 UTC-3, Pedro Henrique Peixoto escreveu:

As far as I understand WAMP, you should never implement application-specific code on the Router. Routers should be completely generic exchangeable black boxes, so it could not do the logging for your application domain.

With that in mind you could implement a Callee WAMP component that would do the logging, and all your other components would call this Logging component before Pub, Sub, Call and Execute.

Att,

Pedro Peixoto.

Em quarta-feira, 29 de julho de 2015 10:09:29 UTC-3, Johnny W. Santos escreveu:

Hello

There is any easy way to log every messages passing through the router? I want to make something like a “transactions history”. I could just create a component subscribed to every topic and log the message content, but how would I know the topic of that message to save it as well?

My goal is to create a queue as a messages buffer, then if a faulty component needs to process some messages it missed, then I could just make a dedicated queue with those messages.

Thanks

Johnny W. Santos

0 Likes

#4

Well, after some research I found the answer.

First I just need to subscribe using match prefix, then it will get every message matching the prefix, as supposed in the first email, then I set some name to details_arg argument in the SubscribeOptions, this way my callback function will receive an extra argument with that name containing a SubscribeOptions instance and one of its attributes is the topic.

Ex: yield self.subscribe(storeMessage, u’com.myapp’, options=SubscribeOptions(match=u’prefix’, details_arg=‘options’))

I think that’s enough to do what I want.

···

Em quarta-feira, 29 de julho de 2015 10:09:29 UTC-3, Johnny W. Santos escreveu:

Hello

There is any easy way to log every messages passing through the router? I want to make something like a “transactions history”. I could just create a component subscribed to every topic and log the message content, but how would I know the topic of that message to save it as well?

My goal is to create a queue as a messages buffer, then if a faulty component needs to process some messages it missed, then I could just make a dedicated queue with those messages.

Thanks

Johnny W. Santos

0 Likes