org.apache.ignite.services

## Interface ServiceCallContext

-     public interface ServiceCallContext

  Service call context.

  This context is implicitly passed to the service and can be retrieved inside the service using `ServiceContext.currentCallContext()`. It is accessible only from the local thread during the execution of a service method.

  Use `builder()` to create the context builder.

  Note: passing the context to the service may lead to performance overhead, so it should only be used for "middleware" tasks.

  Usage example:

       // Service implementation.
       class HelloServiceImpl implements HelloService {
           @ServiceContextResource
           ServiceContext ctx;

           public String call(Strig msg) {
               return msg + ctx.currentCallContext().attribute("user");
           }
           ...
       }
       ...

       // Call this service with context.
       ServiceCallContext callCtx = ServiceCallContext.builder().put("user", "John").build();
       HelloService helloSvc = ignite.services().serviceProxy("hello-service", HelloService.class, false, callCtx, 0);
       // Print "Hello John".
       System.out.println( helloSvc.call("Hello ") );

  See Also:
    `ServiceContext`, `ServiceCallContextBuilder`, `ServiceCallInterceptor`

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `attribute(String name)` Get the string attribute.
    `byte[]` | `binaryAttribute(String name)` Get the binary attribute.
    `static ServiceCallContextBuilder` | `builder()` Create a context builder.

- - ### Method Detail

    - #### builder

          static ServiceCallContextBuilder builder()

      Create a context builder.
      Returns:
        Context builder.

    - #### attribute

          String attribute(String name)

      Get the string attribute.
      Parameters:
        `name` - Attribute name.
      Returns:
        String attribute value.

    - #### binaryAttribute

          byte[] binaryAttribute(String name)

      Get the binary attribute.
      Parameters:
        `name` - Attribute name.
      Returns:
        Binary attribute value.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023