Home Help Center

Message Interception

GreenhippoGreenhippo Member AlexOrganization: University of AucklandProject: Intelligent Middleware ✭✭

Im looking for a way to wrap a servant within another object that can intercept its requests before fowarding them on, but i would like to be able to migrate the wrapper and its internal object together ie to treat them as a single object.

I have no control over what the wrapped object will implement so the wrapper must be able ot pick up everything and foward on the relevant operations

My initial thought was to do this with Blobjects, publishing only blobjects on the registry and foward the messages on, however blobojects can only foward on messages to proxies. This leads to the problem of when trying to migrate the blobject the actual servant will end up being left behind.

Is there any easier way to achieve this that doesnt involve having to migrate both blob and servant


  • GreenhippoGreenhippo Member AlexOrganization: University of AucklandProject: Intelligent Middleware ✭✭
    Alright i worked out a way to do this, if i override the wrapper objects __dispatch() method and have it call the wrapped objects __dispatch() method with the same parameters it seems to work, i can now perform other actions before fowarding the request on.

    tampering with __dispatch() like this seems to work fine currently, but I havent done exhaustive testing on many of the other features of ice, will this solution continue to be effective or is there limits?
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    By depending on __dispatch you are depending on Ice internals that could change with any release.

    I'm also not sure what you mean by migrating the object. If you mean you want to move the object to another server and then have the old server forward the request this is not a very good design. It requires the old server to be always available, have a record of the new server location and its slow. Also consider what happens when you migrate again and then later again. The more migrations the more hops, the more difficult to administer and the more fragile your system becomes.
  • GreenhippoGreenhippo Member AlexOrganization: University of AucklandProject: Intelligent Middleware ✭✭
    By migrate i mean moving the object to a new server then updating the registry with the objects new position. This should prevent all the fowarding of messages (although does add some other issues in keeping the registry up to date)

    The wrapper would add some alternative functionality to the object (like functions to actually perform migration) in a way that the wrapper does not need to know about the internal workings of the object its wrapping and the object its wrapping does not have to know that it will be wrapped

    If you know of another way to achieve this without relying on __dispatch(), which i get the feeling is exploiting internal workings of ice, then im interested in hearing them
Sign In or Register to comment.