Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.13
    • managed services

    Description

      Implement support for passing implicit "request" attributes from the proxy to the Java service.

      Implementation notes.

      1. If no caller attributes are passed - there should be no performance overhead when executing service methods.
      2. Attributes allow only string and byte[] values and does not permit nulls in key/values.
      3. Currently, the context should be immutable, but in the future, it should be possible to change it through the interceptor.
      4. ServiceResource annotation allows to inject service/proxy, we must provide the ability to transparently pass the context to the injected service.

      Public API changes:

      New methods in IgniteServices to pass caller context to service proxy.

      public <T> T serviceProxy(String name, Class<? super T> svcItf, boolean sticky, ServiceCallContext callCtx)
      
      public <T> T serviceProxy(String name, Class<? super T> svcItf, boolean sticky, ServiceCallContext callCtx, long timeout)
      

      New method in ServiceContext for getting caller context inside the service method.

      /**
       * Gets context of the current service call.
       *
       * @return Context of the current service call, possibly {@code null}.
       * @see ServiceCallContext
       */
      @Nullable public ServiceCallContext currentCallContext();
      

      New interface ServiceCallContext

      public interface ServiceCallContext {
          public String attribute(String name);
          public byte[] binaryAttribute(String name);
      }
      

      And the builder ServiceCallContextBuilder for creating ServiceCallContext.

      New property in ServiceResource annotation.

      /**
       * Flag indicating that the service call context should be passed to the injected service.
       *
       * @return {@code True} if the service call context should be passed to the injected service.
       */
      public boolean forwardCallerContext() default false;
      

       

      Attachments

        Issue Links

          Activity

            People

              xtern Pavel Pereslegin
              xtern Pavel Pereslegin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m