How to access the Header properties of a message in Code

I am trying to write a generic process that will take any incoming message but would like to know where it came from so in my code I would like to do something like this

If (Document.Source="some serviceorProcess").

Just to be clear in the route you get these features is there a way of accessing them in code

Answers

You can determine, where does the message comes from by inspecting it's header, get header Id from:

$$$JobCurrentHeaderId

and query Ens.MessageHeader class.

Alternatively, check "process" variable in BPL or current context in ObjectScript processes. Maybe the whole object would be available somewhere.