Re: Async messaging

2017-08-14 Thread Humphrey
Hello, I bumped into the same error. Was not clear to me that you shouldn't
call the future after doing the send:

IgniteMessaging message = ignite.message().withAsync();
message.send("destination", "hello world");
IgniteFuture future = message.future();
log.info("Keeps on throwing exception")

Was giving me the exception:
Exception in thread "pub-#67%null%" java.lang.IllegalStateException:
Asynchronous operation not started.
at
org.apache.ignite.internal.AsyncSupportAdapter.future(AsyncSupportAdapter.java:91)
at
org.apache.ignite.internal.AsyncSupportAdapter.future(AsyncSupportAdapter.java:73)

The correct way to use it is without calling the message.future()

IgniteMessaging message = ignite.message().withAsync();
message.send("destination", "hello world");
log.info("Doing async!")

Hope this helps someone else.



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Async-messaging-tp8719p16157.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Async messaging

2016-11-07 Thread Vladislav Pyatkov
Methods which support asynchronous execution shall be marked with
@IgniteAsyncSupported, but the method
(o.a.i.IgniteMessaging#send(java.lang.Object, java.lang.Object)) does not
have the matched annotation.

You can see the convention in the article [1].

[1]:
http://apacheignite.gridgain.org/docs/async-support#igniteasyncsupported

On Tue, Nov 8, 2016 at 9:22 AM, Andrey Kornev <andrewkor...@hotmail.com>
wrote:

> Daniel,
> A couple of things:
>
> - according to javadocs, IgniteMessaging.send() returns void. To obtain
> the future you should instead call IgniteMessaging.future() immediately
> following the send() call.
>
> - in some cases, Ignite's 'async' operations are actually synchronous.
> Ignite's interpretation of 'asynchronous' is quite unorthodox and the users
> should be aware of possible deadlocks and thread starvation, among other
> things.
>
> Regards,
> Andrey
> _
> From: Daniel Stieglitz <dstiegl...@stainlesscode.com>
> Sent: Saturday, November 5, 2016 1:47 PM
> Subject: Async messaging
> To: <user@ignite.apache.org>
>
>
>
> Hi folks:
>
> We are trying to get messaging working asynchronously. Take a look at the
> code below:
>
> IgniteMessaging rmtMsg = grid.message().withAsync();
>
> def future = rmtMsg.send(destination, message);
>
> log.debug("got future ${future}");
>
>
> That code runs synchronously and the debug says "got future null"
>
> Is there something else we need to configure to get this working?
>
>
> Dan
>
>
>
>


-- 
Vladislav Pyatkov


Re: Async messaging

2016-11-07 Thread Andrey Kornev
Daniel,
A couple of things:

- according to javadocs, IgniteMessaging.send() returns void. To obtain the 
future you should instead call IgniteMessaging.future() immediately following 
the send() call.

- in some cases, Ignite's 'async' operations are actually synchronous. Ignite's 
interpretation of 'asynchronous' is quite unorthodox and the users should be 
aware of possible deadlocks and thread starvation, among other things.

Regards,
Andrey
_
From: Daniel Stieglitz 
<dstiegl...@stainlesscode.com<mailto:dstiegl...@stainlesscode.com>>
Sent: Saturday, November 5, 2016 1:47 PM
Subject: Async messaging
To: <user@ignite.apache.org<mailto:user@ignite.apache.org>>


Hi folks:

We are trying to get messaging working asynchronously. Take a look at the code 
below:

IgniteMessaging rmtMsg = grid.message().withAsync();

def future = rmtMsg.send(destination, message);

log.debug("got future ${future}");


That code runs synchronously and the debug says "got future null"

Is there something else we need to configure to get this working?


Dan




Re: Async messaging

2016-11-07 Thread dstieglitz
Hi Vladislav

Thanks for clarifying. However, we get an error when we try to use the
methods as documented (see below). Does this paradigm also apply to
IgniteMessaging?

Code:

IgniteMessaging rmtMsg = grid.message().withAsync();
rmtMsg.send(destination.topic, message)
def future = rmtMsg.future()
log.debug("got future ${future}")

Error:

Asynchronous operation not started.. Stacktrace follows:
java.lang.IllegalStateException: Asynchronous operation not started.
at
org.apache.ignite.internal.AsyncSupportAdapter.future(AsyncSupportAdapter.java:91)
at
org.apache.ignite.internal.AsyncSupportAdapter.future(AsyncSupportAdapter.java:73)
at
org.grails.ignite.MessagingService.sendMessageAsync(MessagingService.groovy:100)
at XXX.send(MessagingService.groovy:298)
at XXX.propagateCacheEvent(MessagingService.groovy:269)
at XXX.propagateCacheEvent(MessagingService.groovy:264)
at XXX.clearDataCaches(FeedRestoreService.groovy:14)
at XXX.clearCache(SettingsController.groovy:76)
at
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:100)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Async-messaging-tp8719p8733.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Async messaging

2016-11-06 Thread Vladislav Pyatkov
Look at the article about asynchronous support of Ignite[1].
You are need to use method .future(), synchronous result be always null at
this case.

[1]: http://apacheignite.gridgain.org/docs/async-support

On Sat, Nov 5, 2016 at 11:47 PM, Daniel Stieglitz <
dstiegl...@stainlesscode.com> wrote:

> Hi folks:
>
> We are trying to get messaging working asynchronously. Take a look at the
> code below:
>
> IgniteMessaging rmtMsg = grid.message().withAsync();
>
> def future = rmtMsg.send(destination, message);
>
> log.debug("got future ${future}");
>
>
> That code runs synchronously and the debug says "got future null"
>
> Is there something else we need to configure to get this working?
>
>
> Dan
>
>


-- 
Vladislav Pyatkov


Async messaging

2016-11-05 Thread Daniel Stieglitz
Hi folks:

We are trying to get messaging working asynchronously. Take a look at the
code below:

IgniteMessaging rmtMsg = grid.message().withAsync();

def future = rmtMsg.send(destination, message);

log.debug("got future ${future}");


That code runs synchronously and the debug says "got future null"

Is there something else we need to configure to get this working?


Dan