ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evgenii Zhuravlev <e.zhuravlev...@gmail.com>
Subject Re: Using event to reconnect spring created cache client to server
Date Thu, 02 Nov 2017 17:02:33 GMT
Hi,

I don't really understand, what do you mean. At first, a client will try to
reconnect to the cluster with the same id and without
EVT_CLIENT_NODE_RECONNECTED
event. Only if it does not succeed with this, it starts to connect to the
cluster with a new id and generates this event.

What do you want to achieve?

Regards,
Evgenii

2017-11-02 17:46 GMT+03:00 Guilherme Melo <guilherme@gmelo.org>:

> Hello all,
>
> am having a issue with reconnection to a spring created ignite cluster,
> both instances are wrapped in spring boot 1.5.8.RELEASE and Ignite 1.9
>
> Server:
>
> @Autowired
> ApplicationContext context;
>
> @Bean
> public Ignite igniteClient() throws IgniteCheckedException {
>     IgniteConfiguration configuration = new IgniteConfiguration();
>     CacheConfiguration cacheCfg = new CacheConfiguration("myCache");
>     cacheCfg.setCacheMode(CacheMode.PARTITIONED);
>     configuration.setCacheConfiguration(cacheCfg);
>     return IgniteSpring.start(configuration, context);
> }
>
> Client
>
>
> @Autowired
> ApplicationContext context;
>
> @Bean
> public Ignite igniteClient() throws IgniteCheckedException {
>     IgniteConfiguration configuration = new IgniteConfiguration();
>     configuration.setClientMode(true);
>     Ignite ignite = IgniteSpring.start(configuration, context);
>
>     ignite.events().localListen(evt -> {
>         logger.warn("Event: {}", evt);
>         if (EventType.EVT_CLIENT_NODE_RECONNECTED == evt.type()) {
>             //to check the ignite instance is fine
>             logger.info("All caches: {}", ignite.cacheNames());
>             //will hold and eventually throw
>             ignite.cache("myCache");
>         }
>         logger.warn("Event handle end");
>         return true;
>     }, EventType.EVT_CLIENT_NODE_RECONNECTED, EventType.EVT_CLIENT_NODE_DISCONNECTED);
>     return ignite;
> }
>
> is there anything I am missing? something around the dynamic caches?
> Should they be created elsewere? Thanks !
>
>

Mime
View raw message