public class IgniteClientSpringBean extends Object implements IgniteClient, org.springframework.context.SmartLifecycle
ClientConfiguration to be set before bean use
(see setClientConfiguration(ClientConfiguration)}).
A note should be taken that Ignite client instance is started after all other
Spring beans have been initialized and right before Spring context is refreshed.
That implies that it's not valid to reference IgniteClientSpringBean from
any kind of Spring bean init methods like PostConstruct.
If it's required to reference IgniteClientSpringBean for other bean
initialization purposes, it should be done from a ContextRefreshedEvent
listener method declared in that bean.
<bean id="igniteClient" class="org.apache.ignite.IgniteClientSpringBean">
<property name="clientConfiguration">
<bean class="org.apache.ignite.configuration.ClientConfiguration">
<property name="addresses">
<list>
<value>127.0.0.1:10800</value>
</list>
</property>
</bean>
</property>
</bean>
| Modifier and Type | Field and Description |
|---|---|
static int |
DFLT_IGNITE_CLI_LIFECYCLE_PHASE
Default Ignite client
SmartLifecycle phase. |
| Constructor and Description |
|---|
IgniteClientSpringBean() |
| Modifier and Type | Method and Description |
|---|---|
ClientAtomicLong |
atomicLong(String name,
ClientAtomicConfiguration cfg,
long initVal,
boolean create)
Gets an atomic long from cache and creates one if it has not been created yet and
create flag
is true. |
ClientAtomicLong |
atomicLong(String name,
long initVal,
boolean create)
Gets an atomic long from cache and creates one if it has not been created yet and
create flag
is true. |
IgniteBinary |
binary() |
<K,V> ClientCache<K,V> |
cache(String name)
Get existing cache.
|
Collection<String> |
cacheNames()
Gets the names of all available caches.
|
IgniteClientFuture<Collection<String>> |
cacheNamesAsync()
Gets the names of all available caches.
|
void |
close()
Closes this client's open connections and relinquishes all underlying resources.
|
ClientCluster |
cluster()
Gets client cluster facade.
|
ClientCompute |
compute()
Gets compute facade over all cluster nodes started in server mode.
|
ClientCompute |
compute(ClientClusterGroup grp)
Gets compute facade over the specified cluster group.
|
<K,V> ClientCache<K,V> |
createCache(ClientCacheConfiguration cfg)
Creates a cache with the specified configuration.
|
<K,V> ClientCache<K,V> |
createCache(String name)
Creates a cache with a default configuration.
|
<K,V> IgniteClientFuture<ClientCache<K,V>> |
createCacheAsync(ClientCacheConfiguration cfg)
Creates a cache with the specified configuration.
|
<K,V> IgniteClientFuture<ClientCache<K,V>> |
createCacheAsync(String name)
Creates a cache with a default configuration.
|
void |
destroyCache(String name)
Destroys the cache with the given name.
|
IgniteClientFuture<Void> |
destroyCacheAsync(String name)
Destroys the cache with the given name.
|
ClientConfiguration |
getClientConfiguration() |
<K,V> ClientCache<K,V> |
getOrCreateCache(ClientCacheConfiguration cfg)
Gets the existing cache or creates a new cache if it does not exist.
|
<K,V> ClientCache<K,V> |
getOrCreateCache(String name)
Gets the existing cache or creates a new cache with default configuration if it does not exist.
|
<K,V> IgniteClientFuture<ClientCache<K,V>> |
getOrCreateCacheAsync(ClientCacheConfiguration cfg)
Gets the existing cache or creates a new cache if it does not exist.
|
<K,V> IgniteClientFuture<ClientCache<K,V>> |
getOrCreateCacheAsync(String name)
Gets the existing cache or creates a new cache with default configuration if it does not exist.
|
int |
getPhase() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
FieldsQueryCursor<List<?>> |
query(SqlFieldsQuery qry)
Execute SQL query and get cursor to iterate over results.
|
ClientServices |
services()
Gets
services facade over all cluster nodes started in server mode. |
ClientServices |
services(ClientClusterGroup grp)
Gets
services facade over nodes within the cluster group. |
<T> ClientIgniteSet<T> |
set(String name,
@Nullable ClientCollectionConfiguration cfg)
Gets a distributed set from cache.
|
IgniteClientSpringBean |
setClientConfiguration(ClientConfiguration cfg)
Sets Ignite client configuration.
|
IgniteClientSpringBean |
setPhase(int phase)
Sets
SmartLifecycle phase during which the current bean will be initialized. |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
ClientTransactions |
transactions()
Gets client transactions facade.
|
public static final int DFLT_IGNITE_CLI_LIFECYCLE_PHASE
SmartLifecycle phase.public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void stop(Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic void start()
start in interface org.springframework.context.Lifecyclepublic int getPhase()
getPhase in interface org.springframework.context.PhasedgetPhase in interface org.springframework.context.SmartLifecyclepublic <K,V> ClientCache<K,V> getOrCreateCache(String name) throws ClientException
getOrCreateCache in interface IgniteClientK - Type of the cache key.V - Type of the cache value.name - Cache name.ClientExceptionpublic <K,V> IgniteClientFuture<ClientCache<K,V>> getOrCreateCacheAsync(String name) throws ClientException
getOrCreateCacheAsync in interface IgniteClientK - Type of the cache key.V - Type of the cache value.name - Cache name.ClientExceptionpublic <K,V> ClientCache<K,V> getOrCreateCache(ClientCacheConfiguration cfg) throws ClientException
getOrCreateCache in interface IgniteClientK - Type of the cache key.V - Type of the cache value.cfg - Cache configuration. If the cache exists, this configuration is ignored.ClientExceptionpublic <K,V> IgniteClientFuture<ClientCache<K,V>> getOrCreateCacheAsync(ClientCacheConfiguration cfg) throws ClientException
getOrCreateCacheAsync in interface IgniteClientK - Type of the cache key.V - Type of the cache value.cfg - Cache configuration. If the cache exists, this configuration is ignored.ClientExceptionpublic <K,V> ClientCache<K,V> cache(String name)
cache in interface IgniteClientK - Type of the cache key.V - Type of the cache value.name - Cache name.public Collection<String> cacheNames() throws ClientException
cacheNames in interface IgniteClientClientExceptionpublic IgniteClientFuture<Collection<String>> cacheNamesAsync() throws ClientException
cacheNamesAsync in interface IgniteClientClientExceptionpublic void destroyCache(String name) throws ClientException
ClientException if the cache does not exist.destroyCache in interface IgniteClientname - Name of the cache to destroy.ClientExceptionpublic IgniteClientFuture<Void> destroyCacheAsync(String name) throws ClientException
ClientException if the cache does not exist.destroyCacheAsync in interface IgniteClientname - Name of the cache to destroy.ClientExceptionpublic <K,V> ClientCache<K,V> createCache(String name) throws ClientException
createCache in interface IgniteClientK - Type of the cache key.V - Type of the cache value.name - Cache name.ClientExceptionpublic <K,V> IgniteClientFuture<ClientCache<K,V>> createCacheAsync(String name) throws ClientException
createCacheAsync in interface IgniteClientK - Type of the cache key.V - Type of the cache value.name - Cache name.ClientExceptionpublic <K,V> ClientCache<K,V> createCache(ClientCacheConfiguration cfg) throws ClientException
createCache in interface IgniteClientK - Type of the cache key.V - Type of the cache value.cfg - Cache configuration.ClientExceptionpublic <K,V> IgniteClientFuture<ClientCache<K,V>> createCacheAsync(ClientCacheConfiguration cfg) throws ClientException
createCacheAsync in interface IgniteClientK - Type of the cache key.V - Type of the cache value.cfg - Cache configuration.ClientExceptionpublic IgniteBinary binary()
binary in interface IgniteClientIgniteBinary interface.public FieldsQueryCursor<List<?>> query(SqlFieldsQuery qry)
query in interface IgniteClientqry - SQL query.public ClientTransactions transactions()
transactions in interface IgniteClientpublic ClientCompute compute()
compute in interface IgniteClientpublic ClientCompute compute(ClientClusterGroup grp)
ClientCompute instance will only include nodes from
this cluster group.compute in interface IgniteClientgrp - Cluster group.public ClientCluster cluster()
cluster in interface IgniteClientpublic ClientServices services()
services facade over all cluster nodes started in server mode.services in interface IgniteClientpublic ClientServices services(ClientClusterGroup grp)
services facade over nodes within the cluster group. All operations
on the returned ClientServices instance will only include nodes from
the specified cluster group.
Note: In some cases there will be additional requests for each service invocation from client to server
to resolve cluster group.services in interface IgniteClientgrp - Cluster group.Services functionality over given cluster group.public ClientAtomicLong atomicLong(String name, long initVal, boolean create)
create flag
is true.atomicLong in interface IgniteClientname - Name of atomic long.initVal - Initial value for atomic long. Ignored if create flag is false.create - Boolean flag indicating whether data structure should be created if it does not exist.public ClientAtomicLong atomicLong(String name, ClientAtomicConfiguration cfg, long initVal, boolean create)
create flag
is true.atomicLong in interface IgniteClientname - Name of atomic long.cfg - Configuration.initVal - Initial value for atomic long. Ignored if create flag is false.create - Boolean flag indicating whether data structure should be created if it does not exist.public <T> ClientIgniteSet<T> set(String name, @Nullable @Nullable ClientCollectionConfiguration cfg)
cfg is not null.set in interface IgniteClientT - Type of the elements in set.name - Set name.cfg - Set configuration if new set should be created.public void close()
close in interface AutoCloseableclose in interface IgniteClientpublic IgniteClientSpringBean setClientConfiguration(ClientConfiguration cfg)
cfg - Ignite thin client configuration.this for chaining.public ClientConfiguration getClientConfiguration()
public IgniteClientSpringBean setPhase(int phase)
SmartLifecycle phase during which the current bean will be initialized. Note, underlying Ignite
client will be closed during handling of DisposableBean since IgniteClient
implements AutoCloseable interface.phase - SmartLifecycle phase.this for chaining.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023