Consuming services as client from threads inside the server

Home Forums kbmMW Consuming services as client from threads inside the server

This topic contains 2 replies, has 2 voices, and was last updated by  moctes 1 month ago.

  • Author
    Posts
  • #54136

    moctes
    Participant

    Hi everyone,

    I have the need to consume kbmMW services from threads which are running on the same instance as the server, so I was wondering if it was safe to call them simply as:

    result := kbmServerGlobal.Request(‘MyService’,
    ”, inStateID, ClientId, nil, nil,
    ‘MyFunction’, [ parameter ]);

    Where kbmServerGlobal is, well, a global variable holding a reference to a created TkbmMWServer, or should I go the route of creating a TkbmMWClientConnectionPool, TkbmMWPooledSimpleClient for using on this threads and make TkbmMWPooledSimpleClient.Request(s) instead of the former approach ?

    I already made a test just using TkbmMWSimpleClient on each thread and it works fine but creating each connection is slow, maybe a ClientConnectionPool could be better but as the code is already running on the server instance I’m hoping to use the global variable kbmServerGlobal which gives me fast responses but I’m not sure if is thread safe, hence my question.

    What do you think ?

     

  • #54137

    kimbomadsen
    Keymaster

    Hi, As long as your own code, run in the service(s), are threadsafe, the call will be threadsafe.

  • #54139

    moctes
    Participant

    Perfect, thank you Kim

You must be logged in to reply to this topic.