Debug a service onSessionEnter( ), onSessionUpdate( ), onInvoke( ), and onSessionLeave( )

  1. Modify your existing application so that it creates and uses only a single session and sends only a single input to your service. If you want to debug the OnSessionUpdate( ) method, your client must submit an update to the service.

    The intent here is to remove all unnecessary interactions with the middleware so that you can isolate the problem and debug a single service instance without interference.

    Note:

    The system only calls onSessionEnter() and onSessionLeave() if common data is provided by the client. The system only calls OnSessionUpdate() if the client sends an update.

    The system invokes the onSessionLeave(…) method to unbind the current binding session when there is no more work for that session. Sending only one task ensures that the onSessionLeave(…) method is invoked shortly after the task completes.

  2. Edit your application profile and change parameters as follows:
    1. Set the preStartApplication attribute to true.
    2. Set the numOfSlotsForPreloadedServices attribute to 1.
    <Consumer applicationName="MyApplication" consumerId="/consumer" taskHighWaterMark="1.0" taskLowWaterMark="0.0" preStartApplication="true" numOfSlotsForPreloadedServices="1" />
  3. Use the soamreg command or the Console to update your application with your new application profile.

    Your update causes the session director to immediately start a session manager to service your application (preStartApplication="true").

    Your application's session manager requests a single slot and preloads a service instance even before you send it any workload (numOfSlotsForPreloadedServices="1"). The running service instance is not yet bound to a particular session.

  4. Your service instance is a running instance of the executable that was produced by compiling your custom implementation of ServiceContainer. Attach a debugger to your service instance.
  5. Now that you have attached to your service instance, set appropriate breakpoints in the onSessionEnter(…), onSessionUpdate(…), onInvoke(…), and onSessionLeave(…) methods.
  6. Run your client application.
    Provided that you modeled your client using the instructions in step 1, the middleware invokes the following methods on the service instance:
    • onSessionEnter(…) once after the service is bound to your session, if there is common data

    • onSessionUpdate(…) once per update after you have submitted the update from the client

    • onInvoke(…) once (once per input sent to the service)

    • onSessionLeave(…)once just before the service is unbound from your session