You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Mark Richards (Jira)" <ji...@apache.org> on 2022/01/30 18:43:00 UTC

[jira] [Commented] (AVRO-3166) [avro-ipc] Provide similar class as `ResponderServlet` which is not based on servlets (but could be used with Vertx)

    [ https://issues.apache.org/jira/browse/AVRO-3166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17484419#comment-17484419 ] 

Mark Richards commented on AVRO-3166:
-------------------------------------

I'm pretty interested in this feature too.

I've been experimenting with an async implementation here [https://github.com/markalanrichards/privacy-assessment/tree/master/backend/avro-async]

I'm not going to suggest it is any good, most of the effort was spent trying to make sense of the protocol and I'm sure I've missed out significant features, such as appropriate handling of client/server hash mismatches and returning error responses properly.

Also, I wasn't sure about the threadsafety of the existing implementation, if used in an async fashion instead of single thread per invocation fashion: so I may have gone overboard in wrapping things in immutable data structures.

If anyone is interested in this code, then I'm happy to chat about it and possibly even for it to be adopted (except it definitely needs work!).

An abstraction of the client and server that allows developers to apply whatever framework they like over the top (servlets, Spring, VertX, Akka, ...) would be great. 

I relied on the Callback classes generated by Avro, but I suspect a good solution would offer to remove the synchronous methods for server side stubs and perhaps consider return types like futures instead of callback parameters: it's hard to spot a method that is not implemented with callbacks as the lack of a necessary return type means the automatically generated stub is legal Java (it'll just hang the application if executed).

> [avro-ipc] Provide similar class as `ResponderServlet` which is not based on servlets (but could be used with Vertx)
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-3166
>                 URL: https://issues.apache.org/jira/browse/AVRO-3166
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.10.2
>            Reporter: Jiri Ondrusek
>            Priority: Major
>
> I'm fixing issue in avro-rpc extension from camel-quarkus  - [#2651|https://github.com/apache/camel-quarkus/issues/2651]]
>  
> I prepared fix, where I'm replacing provider for http server from Jetty to Vertx ([PR|https://github.com/apache/camel-quarkus/pull/2859]).]
>  
> I faced problem, when I needed to call methods: `HttpTransciever#writeBuffers`, `HttpTransciever#writeLength` and `HttpTranscier#readBuffers`. Unfortunately the only publicly accessible method is through `ResponderServlet`. Therefore I had to create simple `HttpServletRequest` and `HttpServletResponse` based on Vertx's Buffer. 
>  
> It would be nice, if there was method/methods for such purpose:
>  * based for example on `InputStream` and `OutputStream` 
>  (I'm using in my [PR|https://github.com/apache/camel-quarkus/pull/2859] `byte[]` and `ByteArrayOutpuStream`)
>  * or even based on Vertx
> It would be also nice to have a `avro-ipc` artifact without a dependency on servlet api.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)