![]() |
License / Documentation home / Help and feedback | ![]() |
The Galaxy Communicator infrastructure has evolved considerably in the way it handles references to servers. The Hub, for instance, makes the distinction between service types, which is a set of operations the Hub can perform, and service providers, which are the individual Communicator-compliant servers which implement these operations.
In version 4.0, we have enhanced and rendered consistent the way programmers can refer to these service providers. Until this release, it was possible to describe providers in various ways (e.g., by their service type), but not to identify them uniquely. This could be a problem in situations where, for instance, the programmer desires to use only asynchronous invocations to support synchronous interactions, but the Hub maintains connections to multiple providers of the affected type. If the programmer was either unwilling or unable to lock the server to the session, or if the session itself could make use of multiple providers for the affected type (for load balancing, for instance), the programmer had no other options. Now, provider names fill this gap.
"["<id>"]"(<service_type>)That is, the provider name begins with a left square bracket ("["), followed by an ID, followed by a right square bracket ("]"), followed optionally by the name of a service type (declared by either the SERVICE_TYPE: or SERVER: directives in the Hub script).
[4]The integers are assigned by the Hub when the Hub first learns of the existence of each provider: either one it should contact, or one that contacts it. The non-integer IDs are assigned by the Hub programmer, as follows:
[myparser]Parser
[17]Dialogue
SERVICE_PROVIDER: ParserThese provider names are used in a number of different contexts, which we describe here and in the Hub program reference document.
PROVIDER_ID: [myparser]
[7]Parser@foo.bar.com:1567
The Hub selects a provider to use according to the following rules. These rules apply either to scriptless interaction or to the RHS of Hub program rules.
If the operation name prefix is the name of a service type, the Hub restricts its search to providers of that type. This restriction can be valuable if multiple service types support the same operation. For example, the following rule directs the Hub to consider only those providers of service type jupiter:
RULE: :request_frame & :key_value & :domain Jupiter --> jupiter.turn_managementAlternatively, if an incoming message named jupiter.turn_management matches no program name (i.e., it's scriptless), the Hub will consider relaying it only to providers of service type jupiter.
The operation name prefix can also be a provider name. In this case, the Hub will consider only one provider, namely the one with the specified name. For example, the following rule directs the Hub to consider only the provider with id 1:
RULE: :request_frame & :key_value & :domain Jupiter --> [1].turn_managementIn the scriptless case (i.e., if the Hub receives a message named [1].turn_management which matches no program), the same restriction would apply.
RULE: :request_frame & :key_value & :domain Jupiter --> turn_management
PROVIDER_NAME: :stored_provider
PROGRAM: jupiter.turn_managementThe Communicator infrastructure does provide a way to bypass this potential override (i.e., force a scriptless interaction). The functions GalSS_EnvWriteFrameToProvider and GalSS_EnvDispatchFrameToProvider accomplish this.
...PROGRAM: [1].turn_management
...
int GalSS_EnvWriteFrameToProvider(GalSS_Environment
*env, Gal_Frame frame, const char *provider_id, int
do_block)
Like GalSS_EnvWriteFrame,
but directs the message to the provider name or service type name specified
by provider_id and bypasses Hub program matching.
Gal_Frame GalSS_EnvDispatchFrameToProvider(GalSS_Environment
*env, Gal_Frame frame, const char *provider_id, GalIO_MsgType
*t)
Like GalSS_EnvDispatchFrame,
but directs the message to the provider name or service type name specified
by provider_id and bypasses Hub program matching.
If you need to know the name of the provider you want to direct the message to, you can retrieve it in one of two ways: either by using the $id entity reference function or the function GalSS_EnvGetOriginatingProvider.
char *GalSS_EnvGetOriginatingProvider(GalSS_Environment
*env)
This function returns the provider name of the provider associated with
the environment env which originated the token (i.e., sent the new
message which caused the Hub to create the token). This provider name will
be available in the context of a dispatch function invocation, and will
be stored in any environment (or a copy of any such environment) which is
created for this purpose, because this information is provided by the Hub
along with each dispatch function invocation. If the environment env
doesn't have this information recorded (e.g., if it wasn't created for a
dispatch function invocation), this function returns NULL.
![]() |
License / Documentation home / Help and feedback | ![]() |