You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/07/18 14:51:38 UTC

[GitHub] [ignite] xtern opened a new pull request, #10162: IGNITE-17366 Documentation and examples for services middleware.

xtern opened a new pull request, #10162:
URL: https://github.com/apache/ignite/pull/10162

   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925518217


##########
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:
   I meant _**a Map with custom paramters**_, 
   anyway it was confusing and I decided to remove it, thanks.



##########
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:
   I meant _**a Map with custom parameters**_, 
   anyway it was confusing and I decided to remove it, thanks.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925518217


##########
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:
   I meant "_**a** Map with custom parameters_", 
   anyway it sounds confusing and I decided to remove it, thanks.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925518217


##########
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:
   I meant _*a* Map with custom parameters_, 
   anyway it was confusing and I decided to remove it, thanks.



##########
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:
   I meant _**a** Map with custom parameters_, 
   anyway it was confusing and I decided to remove it, thanks.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern merged pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern merged PR #10162:
URL: https://github.com/apache/ignite/pull/10162


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925520461


##########
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:
   Done, thanks



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925515736


##########
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:
   Done, thanks



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] EZabotkin commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925519897


##########
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:
   Done, thanks



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite] xtern commented on a diff in pull request #10162: IGNITE-17366 Documentation and examples for services middleware.

Posted by GitBox <gi...@apache.org>.
xtern commented on code in PR #10162:
URL: https://github.com/apache/ignite/pull/10162#discussion_r925519665


##########
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:
   Done, thanks



##########
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:
   Done, thanks



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org