Well, LogWriter assumes a specific semantics from the underlying transport. Async APIs usually give you access to the fd, and the needed I/O event mask. If that's the case, you can probably integrate it to syslog-ng's mainloop, which is ivykis based (an async event lib).

But you can create a separate event loop if that's easier. E.g. use a single thread for all kafka destinations.

Can you explain your use-case why the existing kafka destination is not good enough? Is it performance, is it java?

 ❦ 22 janvier 2016 12:43 +0100, "Scheidler, Balázs" <balazs.scheidler@balabit.com> :

> well, the afsocket one. that's a completely nonblocking destination
> that implements udp/tcp/unix-stream/unix-dgram/syslog/network sources
> and destinations.
>
> It basically boils down to using a LogWriter class that does the heavy
> lifting at least as long as your transport protocol is simple enough.
> Probably the simplest is to create a LogProto implementation and let
> the afsocket driver do the rest.
>
> Asynchronous sources/destinations operate on a set of worker threads
> (in contrast to a dedicated thread) and are driven by the epoll()
> based event loop.

It's for the librdkafka-based kafka destination. So, the third-party
library is taking care of all the transport stuff. Is the afsocket one
still a good example for async stuff in this case? I didn't have a look
yet.
--
Don't compare floating point numbers just for equality.
            - The Elements of Programming Style (Kernighan & Plauger)
______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq