WebSocketHandler.onMessage() does not appear to execute in the context of a ratpack-managed thread

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

WebSocketHandler.onMessage() does not appear to execute in the context of a ratpack-managed thread

Kim Christian Gaarder
Get exceptions of the type: "ratpack.exec.UnmanagedThreadException: Operation attempted on non Ratpack managed thread 'ratpack-compute-1-3'" when attempting to use Blocking.get() from WebSocketHandler.onMessage(WebSocketMessage<T>) context. Handler was set up using ratpack.websocket.WebSockets.websocket(Context, WebSocketHandler<?>) to set up web-socket handler.

I have created a workaround library for this: https://github.com/Cantara/ratpack-websockets

I just started using ratpack, and so I'm no expert on this. Does anyone here know what the intended behavior of Blocking.get() is from a WebSocketHandler.onMessage() context? Should it throw exception, or not?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WebSocketHandler.onMessage() does not appear to execute in the context of a ratpack-managed thread

Stan
Hi,  

Several months ago, when I was figuring out how to use a ratpack websocket handler to send queries and get result sets, I saw your post, but never had this problem until today.   It would still work if I ran ratpack in the debugger though...  

I dropped in your interface and moved my impl to onManagedMessage(), and now it works again.

Thanks!  But I sure wish I knew what I'm doing wrong.
Loading...