// 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.
= Cluster Groups

:javaFile: {javaCodeDir}/ClusterAPI.java

The `ClusterGroup` interface represents a logical group of nodes, which can be used in many of Ignite's APIs when you want to limit the scope of specific operations to a subset of nodes (instead of the whole cluster). For example, you may wish to deploy a service only on remote nodes or execute a job only on the set of nodes that have a specific attribute.
////
TODO: explain attributes
////
TIP: Note that the `IgniteCluster` interface is also a cluster group which includes all the nodes in the cluster.

You can limit job execution, service deployment, messaging, events, and
other tasks to run only on a specific set of node. For example, here is
how to broadcast a job only to remote nodes (excluding the local node).

[tabs]
--
tab:Java[]
[source,java]
----
include::{javaFile}[tag=remote-nodes,indent=0]
----
tab:C#/.NET[]
[source,csharp]
----
include::code-snippets/dotnet/ClusterGroups.cs[tag=broadcastAction,indent=0]
----
tab:C++[]
[source,cpp]
----
include::code-snippets/cpp/src/broadcast_jobs_to_remote_nodes.cpp[tag=remote-nodes,indent=0]
----
--


For convenience, Ignite comes with a number of predefined cluster groups.


[tabs]
--
tab:Java[]
[source,java]
----
include::{javaFile}[tag=group-examples,indent=0]
----
tab:C#/.NET[]
[source,csharp]
----
include::code-snippets/dotnet/ClusterGroups.cs[tag=clusterGroups,indent=0]
----
tab:C++[]
[source,cpp]
----
include::code-snippets/cpp/src/predefined_cluster_groups.cpp[tag=cluster-groups,indent=0]
----
--

