Allow to add handlers names (#48)
Closed
Bartosz Małkowski opened 4 years ago

Allow to add handlers names in RequestBuilder and names for requests. It is required for debugging.

Bartosz Małkowski commented 4 years ago

There are two ways to set name for Request:

pingModule.ping().name("Odbiorca w SimpleClient").response { }

and

pingModule.ping().response("Odbiorca w SimpleClient") { }

Note, that there are a lot of logging messages at FINEST level.

Artur Hefczyc commented 4 years ago

Great, thank you. And now, how to access this string from Handler? I mean, I would like to log "before" and "after" record for each handler which is called in AbstractEventBus.fire. And of course I would like to print handler's name in the log.

Bartosz Małkowski commented 4 years ago

You cannot get it in handler, because you have access only to Result. But if you enable log level FINEST you will be overloaded with informations about request and its name. Inside your handler, you have to add own logs.

Artur Hefczyc commented 4 years ago

Yes, I have just found this in the code, thank you.

Artur Hefczyc commented 4 years ago

OK, I probably do not understand it fully. But it seems to me this does not solve the main problem.

Let's say, we have 3 handlers registered for IQ Bind stanza. When the stanza is received, all the handlers are called but the above code does not allow us to have a name or any identification for the handler, right?

The code above only allows to assign name to handlers which are created at the time of making the request?

Bartosz Małkowski commented 4 years ago

Yes: you are allowed to assign name to handler only when you make request. So: we can add names for requests in library code to see details of handlers calling. I think that in handlers in client code, should be normal logging to see what's going on. Named handlers should be used to diagnose problems with library code.

Artur Hefczyc commented 4 years ago

Ok, I will try to apply this approach. Thank you.

issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
Spent time
2h 45m
Issue Votes (0)
Watchers (0)
Reference
tigase/_libraries/halcyon#48
Please wait...
Page is in error, reload to recover