class BeatsFrameHandler {

    public void handle(final BeatsFrame frame, final ChannelResponder<SocketChannel> responder, final String sender)
            throws IOException, InterruptedException {

        final Map<String, String> metadata = EventFactoryUtil.createMapWithSender(sender.toString());
        metadata.put(BeatsMetadata.SEQNUMBER_KEY, String.valueOf(frame.getSeqNumber()));
        String line = "";

        /* If frameType is a JSON , parse the frame payload into a JsonElement so that all JSON elements but "message"
        are inserted into the event metadata.

        As per above, the "message" element gets added into the body of the event
        */
        if (frame.getFrameType() == FRAME_JSON ) {
            // queue the raw event blocking until space is available, reset the buffer
            final E event = eventFactory.create(frame.getPayload(), metadata, responder);
            events.offer(event);
        }
    }

    public  BeatsFrameHandler(final SelectionKey selectionKey,
                             final Charset charset,
                             final EventFactory<E> eventFactory,
                             final BlockingQueue<E> events,
                             final AsyncChannelDispatcher dispatcher,
                             final ComponentLog logger);

}