(Migrated) Name of channel

(This message has been automatically imported from the retired mailing list)

Suppose I have two incoming channels, channel1 and channel2, configured
with different authentication but invoking the same service. Can the
service find out which channel it was invoked by?

Inside the service I find:

  • self.name = the name of the service itself (hence same for both
    channel1 and channel2)
  • self.channel = the type of the channel (e.g. “http-soap”, also same
    for both)

Regards,

Brian.

On 04/03/16 18:08, Brian Candler wrote:

Suppose I have two incoming channels, channel1 and channel2, configured
with different authentication but invoking the same service. Can the
service find out which channel it was invoked by?

Inside the service I find:

  • self.name = the name of the service itself (hence same for both
    channel1 and channel2)
  • self.channel = the type of the channel (e.g. “http-soap”, also same
    for both)

Hi Brian,

yes, self.channel is one of few things I am not happy about myself. This
really should be:

(etc.)

To get the name of the channel you need to access self.wsgi_environ:

self.wsgi_environ[‘zato.http.channel_item’].name

But this is only available from a service that is actually mounted on an
HTTP channel. Otherwise self.wsgi_environ is empty.

So if you invoke another service you need to pass the channel’s name to
that other service explicitly.

thanks,