Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • All specified interceptors are guaranteed to be executed before calling the service method.
  • Listeners are notified asynchronously.
  • The server interceptor binds to the service itself (it must be executed where the service is implemented, if on Java then in Java, if on Net then in Net).
  • If the interceptor throws an exception, the service method is not executed, but the rest of the interceptors are executed. This exception is passed to the user and to the listeners.
  • Any interceptor can change the RequestContext.
  • RequestContext must be accessible inside the service(?).

Example of usage (diagram)

draw.io Diagram
bordertrue
diagramNamemiddleware
simpleViewerfalse
width
linksauto
tbstyletop
lboxtrue
diagramWidth1001
revision9

Example of usage (code)

Code Block
languagejava
themeConfluence
    ServiceCallInterceptor security = (mtd, args, ctx) -> {
        if (!CustomSecurityProvider.get().checkPermissions(mtd, ctx.value("sessionId")))
            throw new SecurityException("Method invocation is not permitted");

        return null;
    }

    ServiceCallInterceptor audit = (mtd, args, ctx) -> {
        return (res, err) -> {
            AuditProvider.get().recordEvent(mtd, ctx.value("sessionId"), err);
        }
    }

    ServiceConfiguration svcCfg = new ServiceConfiguration()
        .setName("service")
        .setService(new MyServiceImpl())
        .setMaxPerNodeCount(1)
        .setInterceptors(Arrays.asList(security, audit));

    // Deploy service.
    ignite.services().deploy(svcCfg);

    ...

    // Set context paramters for service proxy.
    ignite.services().serviceProxy("service", MyService.class, false, Collections.singleton("sessionId", sessionId), 0);


Risks and Assumptions

// Describe project risks, such as API or binary compatibility issues, major protocol changes, etc.

...