EZabotkin commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925404647


##########
docs/_docs/services/services.adoc:
##########
@@ -291,6 +294,78 @@ instead (`IgniteServices.serviceProxy(...)`).
 an issue for real jobs like working with a DB or a cache.
 ====
 
+== Service Middleware
+
+WARNING: This feature is experimental and may change in future releases.
+
+[CAUTION]
+====
+This feature may affect performance of service execution.
+====
+
+Apache Ignite allows the user to implement custom middleware logic for his 
services and provides the following features:
+
+1. Ability to implicitly pass custom immutable parameters from proxy to 
service (similar to request headers).
+2. Ability to define custom interceptor for service method calls.
+
+=== Service Call Context
+This feature allows the user to implicilty pass parameters to any service 
method without service re-deployment.
+
+The user can create context (map with custom parameters) and bind it to the 
service proxy. After that, each call to the proxy method will also implicitly 
pass context parameters to the service.

Review Comment:
   map [what?] with custom parameters



##########
docs/_docs/services/services.adoc:
##########
@@ -291,6 +294,78 @@ instead (`IgniteServices.serviceProxy(...)`).
 an issue for real jobs like working with a DB or a cache.
 ====
 
+== Service Middleware
+
+WARNING: This feature is experimental and may change in future releases.
+
+[CAUTION]
+====
+This feature may affect performance of service execution.
+====
+
+Apache Ignite allows the user to implement custom middleware logic for his 
services and provides the following features:

Review Comment:
   Apache Ignite allows the user to implement custom middleware logic for his 
services and provides the following features --> Apache Ignite allows users to 
implement custom middleware logic for their services and provides the following 
features



##########
docs/_docs/services/services.adoc:
##########
@@ -291,6 +294,78 @@ instead (`IgniteServices.serviceProxy(...)`).
 an issue for real jobs like working with a DB or a cache.
 ====
 
+== Service Middleware
+
+WARNING: This feature is experimental and may change in future releases.
+
+[CAUTION]
+====
+This feature may affect performance of service execution.
+====
+
+Apache Ignite allows the user to implement custom middleware logic for his 
services and provides the following features:
+
+1. Ability to implicitly pass custom immutable parameters from proxy to 
service (similar to request headers).
+2. Ability to define custom interceptor for service method calls.
+
+=== Service Call Context
+This feature allows the user to implicilty pass parameters to any service 
method without service re-deployment.
+
+The user can create context (map with custom parameters) and bind it to the 
service proxy. After that, each call to the proxy method will also implicitly 
pass context parameters to the service.
+
+[tabs]
+--
+tab:Java[]
+[source, java]
+----
+include::{javaFile}[tags=service-call-context-create, indent=0]
+----
+tab:C#/.NET[]
+--
+
+The user can read the `call context` using the `currentCallContext` method of 
`ServiceContext`.
+
+NOTE: Service call context is only accessible from the current thread during 
the execution of a service method.
+
+[tabs]
+--
+tab:Java[]
+[source, java]
+----
+include::{javaEchoServiceFile}[tags=service-call-context-read, indent=0]
+----
+tab:C#/.NET[]
+--
+
+=== Service Interceptor
+This feature allows the user to intercept the call to any service method except

Review Comment:
   the user --> users (you don't have a specific user, 'the' is incorrect here)



##########
docs/_docs/services/services.adoc:
##########
@@ -291,6 +294,78 @@ instead (`IgniteServices.serviceProxy(...)`).
 an issue for real jobs like working with a DB or a cache.
 ====
 
+== Service Middleware
+
+WARNING: This feature is experimental and may change in future releases.
+
+[CAUTION]
+====
+This feature may affect performance of service execution.
+====
+
+Apache Ignite allows the user to implement custom middleware logic for his 
services and provides the following features:
+
+1. Ability to implicitly pass custom immutable parameters from proxy to 
service (similar to request headers).
+2. Ability to define custom interceptor for service method calls.
+
+=== Service Call Context
+This feature allows the user to implicilty pass parameters to any service 
method without service re-deployment.
+
+The user can create context (map with custom parameters) and bind it to the 
service proxy. After that, each call to the proxy method will also implicitly 
pass context parameters to the service.
+
+[tabs]
+--
+tab:Java[]
+[source, java]
+----
+include::{javaFile}[tags=service-call-context-create, indent=0]
+----
+tab:C#/.NET[]
+--
+
+The user can read the `call context` using the `currentCallContext` method of 
`ServiceContext`.
+
+NOTE: Service call context is only accessible from the current thread during 
the execution of a service method.
+
+[tabs]
+--
+tab:Java[]
+[source, java]
+----
+include::{javaEchoServiceFile}[tags=service-call-context-read, indent=0]
+----
+tab:C#/.NET[]
+--
+
+=== Service Interceptor
+This feature allows the user to intercept the call to any service method except
+lifecycle methods (`init()`, `execute()` and `cancel()`).
+
+The user can specify one or more interceptors in the `ServiceConfiguration`. 
They are deployed with the service using the same class loader.
+
+Each interceptor invokes the next interceptor in the chain using a delegated 
call, the last interceptor will call the service method.

Review Comment:
   the last interceptor calls the service method



##########
docs/_docs/services/services.adoc:
##########
@@ -291,6 +294,78 @@ instead (`IgniteServices.serviceProxy(...)`).
 an issue for real jobs like working with a DB or a cache.
 ====
 
+== Service Middleware
+
+WARNING: This feature is experimental and may change in future releases.
+
+[CAUTION]
+====
+This feature may affect performance of service execution.
+====
+
+Apache Ignite allows the user to implement custom middleware logic for his 
services and provides the following features:
+
+1. Ability to implicitly pass custom immutable parameters from proxy to 
service (similar to request headers).
+2. Ability to define custom interceptor for service method calls.
+
+=== Service Call Context
+This feature allows the user to implicilty pass parameters to any service 
method without service re-deployment.
+
+The user can create context (map with custom parameters) and bind it to the 
service proxy. After that, each call to the proxy method will also implicitly 
pass context parameters to the service.
+
+[tabs]
+--
+tab:Java[]
+[source, java]
+----
+include::{javaFile}[tags=service-call-context-create, indent=0]
+----
+tab:C#/.NET[]
+--
+
+The user can read the `call context` using the `currentCallContext` method of 
`ServiceContext`.
+
+NOTE: Service call context is only accessible from the current thread during 
the execution of a service method.
+
+[tabs]
+--
+tab:Java[]
+[source, java]
+----
+include::{javaEchoServiceFile}[tags=service-call-context-read, indent=0]
+----
+tab:C#/.NET[]
+--
+
+=== Service Interceptor
+This feature allows the user to intercept the call to any service method except
+lifecycle methods (`init()`, `execute()` and `cancel()`).
+
+The user can specify one or more interceptors in the `ServiceConfiguration`. 
They are deployed with the service using the same class loader.
+
+Each interceptor invokes the next interceptor in the chain using a delegated 
call, the last interceptor will call the service method.
+So the interceptor specified first in the configuration will process the 
result of the service method execution last.

Review Comment:
   So, the interceptor specified first in the configuration is the last 
interceptor processing the result of the service method execution.



##########
examples/src/main/java/org/apache/ignite/examples/servicegrid/ServiceMiddlewareExample.java:
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.servicegrid;
+
+import java.util.Date;
+import java.util.concurrent.Callable;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.services.ServiceCallContext;
+import org.apache.ignite.services.ServiceCallInterceptor;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceContext;
+
+/**
+ * The example shows how to add a middleware layer for distributed services in 
Ignite.
+ * <p>
+ * To start remote nodes, you must run {@link ExampleNodeStartup} in another 
JVM

Review Comment:
   To start remote nodes, run {@link ExampleNodeStartup} in another JVM. It 
will start a node with {@code examples/config/example-ignite.xml} configuration.



##########
examples/src/main/java/org/apache/ignite/examples/servicegrid/ServiceMiddlewareExample.java:
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.servicegrid;
+
+import java.util.Date;
+import java.util.concurrent.Callable;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.services.ServiceCallContext;
+import org.apache.ignite.services.ServiceCallInterceptor;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceContext;
+
+/**
+ * The example shows how to add a middleware layer for distributed services in 
Ignite.
+ * <p>
+ * To start remote nodes, you must run {@link ExampleNodeStartup} in another 
JVM
+ * which will start node with {@code examples/config/example-ignite.xml} 
configuration.
+ * <p>
+ * NOTE:<br/>
+ * Starting {@code ignite.sh} directly will not work, as distributed services 
(and interceptors)
+ * cannot be peer-deployed and classes must be on the classpath for every node.

Review Comment:
   in the classpath for each node



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to