Re: Using event to reconnect spring created cache client to server

2017-11-16 Thread gunman524
guil, could you share your solution?

Many thanks



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Using event to reconnect spring created cache client to server

2017-11-16 Thread Nikolai Tikhonov
Also you can annotate your Listener or Filter class by IgniteAsyncCallback
annotation. In this case a callback will be called from other thread.

On Thu, Nov 16, 2017 at 7:13 PM, ezhuravlev 
wrote:

> gunman524, I didn't say anything like that.
>
> I said that if you want to access cache from CQ, you need to start a new
> thread
>
> Evgenii
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: Using event to reconnect spring created cache client to server

2017-11-16 Thread ezhuravlev
gunman524, I didn't say anything like that. 

I said that if you want to access cache from CQ, you need to start a new
thread

Evgenii



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Using event to reconnect spring created cache client to server

2017-11-16 Thread Evgenii Zhuravlev
The solution that I shared earlier is recommended I think.

Regards,
Evgenii

2017-11-16 17:31 GMT+03:00 Guilherme Melo :

> Is there a recommended pattern for reconnecting continuous queries after a
> disconnect event?
>
> Thanks !
>
> Cheers,
>
> Guilherme Melo
> www.gmelo.org
>
> On 16 November 2017 at 20:25, ezhuravlev  wrote:
>
>> It's not recommended to access caches from listeners. It's a general
>> practice
>> to create a new thread after you get an event.
>>
>> Evgenii
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>
>


Re: Using event to reconnect spring created cache client to server

2017-11-16 Thread Guilherme Melo
Is there a recommended pattern for reconnecting continuous queries after a
disconnect event?

Thanks !

Cheers,

Guilherme Melo
www.gmelo.org

On 16 November 2017 at 20:25, ezhuravlev  wrote:

> It's not recommended to access caches from listeners. It's a general
> practice
> to create a new thread after you get an event.
>
> Evgenii
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: Using event to reconnect spring created cache client to server

2017-11-16 Thread guojin0524


Re: Using event to reconnect spring created cache client to server

2017-11-16 Thread ezhuravlev
It's not recommended to access caches from listeners. It's a general practice
to create a new thread after you get an event.

Evgenii



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Using event to reconnect spring created cache client to server

2017-11-14 Thread Guilherme Melo
That worked, is it a reentry issue?
Should be flagged as a bug?
Because reconnecting a continuous query from a disconnect event should be
standard right?

On 14 Nov 2017 6:35 p.m., "ezhuravlev"  wrote:

> Try to start a new thread and access cache from it.
>
> Evgenii
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: Using event to reconnect spring created cache client to server

2017-11-14 Thread ezhuravlev
Try to start a new thread and access cache from it.

Evgenii



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Using event to reconnect spring created cache client to server

2017-11-09 Thread Guilherme Melo
That's the problem, after the call to cache ("my-cache") it just holds,
which is quite odd, because the call to get all cache names works normally,
but attempting to get the instance fails.

I can see from the topology that it connects to the correct cluster.

Thanks

On 9 Nov 2017 11:55 p.m., "Evgenii Zhuravlev" 
wrote:

> Hey,
>
> Which exception threw there? Could you share stacktrace?
>
> Does here really client reconnects to the same cluster, or it was after
> the server node was restarted?
>
> Evgenii
>
>
> 2017-11-09 18:34 GMT+03:00 guillMelo :
>
>> Hello,
>> I am sorry If I am not being clear, my goal is that, once the client
>> cannot
>> reconect to the cluster as the EVT_CLIENT_NODE_RECONNECTED event is
>> triggered, I want to get a IgniteCache instance so I can re-register a
>> continuous query. however, after the event is trigger if I do a
>> ignite.cache("cachename") It just fails silently.
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>
>


Re: Using event to reconnect spring created cache client to server

2017-11-09 Thread Evgenii Zhuravlev
Hey,

Which exception threw there? Could you share stacktrace?

Does here really client reconnects to the same cluster, or it was after the
server node was restarted?

Evgenii


2017-11-09 18:34 GMT+03:00 guillMelo :

> Hello,
> I am sorry If I am not being clear, my goal is that, once the client cannot
> reconect to the cluster as the EVT_CLIENT_NODE_RECONNECTED event is
> triggered, I want to get a IgniteCache instance so I can re-register a
> continuous query. however, after the event is trigger if I do a
> ignite.cache("cachename") It just fails silently.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: Using event to reconnect spring created cache client to server

2017-11-09 Thread guillMelo
Hello,
I am sorry If I am not being clear, my goal is that, once the client cannot
reconect to the cluster as the EVT_CLIENT_NODE_RECONNECTED event is
triggered, I want to get a IgniteCache instance so I can re-register a
continuous query. however, after the event is trigger if I do a
ignite.cache("cachename") It just fails silently.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Using event to reconnect spring created cache client to server

2017-11-02 Thread Evgenii Zhuravlev
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 :

> 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 !
>
>


Using event to reconnect spring created cache client to server

2017-11-02 Thread Guilherme Melo
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 !