Forum Discussion

ScottUFR's avatar
ScottUFR
Occasional Contributor
6 years ago

Coordinate responses of multiple mocks

Hi,

I need to coordinate the responses of two or more mocks.  One service provides planned vehicle route information and one or more other services provide "real-time" vehicle positions after the vehicle begins traveling from its departure to arrival location.  I've thought about implementing a "coordinator" service that the others communicate with, but it isn't clear how I would discover the coordinator service's endpoint since we run these mocks both in SoapUI proper and in Tomcat.

 

Any ideas would be greatly appreciated.

Thanks

Scott

 

9 Replies

  • Olga_T's avatar
    Olga_T
    SmartBear Alumni (Retired)

    Hi ScottUFR,

    Thanks for reaching out.

     

    Community, can anyone assist Scott here please? Maybe has anyone faced a similar task?

     

    Thank you in advance,

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Scott,

     

    I am not sure I got the actual case...

    By definition, (most of) web communication is stateless and HTTP is based on the request-response design.

    The above means that web client and web server are required for the HTTP session and it is client who sends requests to the server and server responds to the request. As communication is stateless, this means that no coordination is needed.

    Your scenario assumes two pairs of clients and servers. First client requests route from the server and the second client requests vehicle's position.

    Web servers (and your mocks mimic web servers while they are absent) should not (and, usually, cannot) monitor whether the route for some vehicle was provided in order to start/allow provide coordinates for this given vehicle. If required, this must be a functionality of some intermediate back-end layer and I am not sure that you must implement its functionality. (As you are imitating web servers and their task is to provide the client with the route and current coordinates.)

     

    Did I miss something essential in your scenario? What actual coordination you assumed?

     

    P.S. Something that seems to be interesting and might appear to be relevant: https://restfulapi.net/hateoas/

     

    • ScottUFR's avatar
      ScottUFR
      Occasional Contributor

      I'll try to clarify my scenario.

       

      A vehicle's route is planned by a user to occur at a particular time and submitted.  When that vehicle is enroute, it's location is uploaded.  A client requests the planned route from one service and requests enroute locations from a second service.

       

      The planned route service's mock modifies a template response with times that are a short time in the future.  The enroute track service's mock needs to modify it's templated responses to be within the the window defined by the planned route service's mock.  This is the coordination I'm looking for.

       

      Scott

       

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        OK... How these services are expected to coordinate in the real life?

         

        > times that are a short time in the future.

        Just curious, whether these services are expected to be used within the same time zone? What if the route starts in one time zone and end in another one?

         

        Meanwhile, if both mocks are implemented within the same SoapUI project, why not to create a custom project property and use it for coordination?