Consuming services as client from threads inside the server

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

  • This topic has 2 replies, 2 voices, and was last updated 6 months ago by moctes.
Viewing 2 reply threads
  • Author
    • #54136

      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

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

    • #54139

      Perfect, thank you Kim

Viewing 2 reply threads
  • You must be logged in to reply to this topic.