This is my proposal for creating secure, typesafe conversations using CDI Events.  As opposed to using an external API, what if we use an interface like so:

package org.muhtest.server;

import org.jboss.errai.cdi.server.ConversationalEvent;
import org.muhtest.client.ClientMsg;
import org.muhtest.client.ServerMsg;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;

@ApplicationScoped
public class HelloWorldService {
    public void receive(@Observes ConversationalEvent<ClientMsg, ServerMsg> event) {
        /**
         * Get the incoming event.
         */
        ClientMsg incoming = event.getEvent();

        /**
         * Build the outgoing event.
         */
        ServerMsg outgoing = new ServerMsg(incoming.getMessage());

        /**
         * Return to sender!
         */
        event.fire(outgoing);
    }
}

Basically we create a a standard ConversationalEvent interface that is parameterized with the incoming type, and the outgoing type. The EventDispatcher can then simply wrap the incoming event before firing it into the BeanManager, and this way, the event payload itself contains a pre-loaded firing mechanism to fire an outgoing message back to the client. 

I have already hacked a simple prototype on top of Heiko and Fillip's CDI integration code. 

I added Dan Allen to this message, as I thought he might have something interesting to say, since he worked on this aspect of the CDI spec. 

Thoughts?

Mike.