class RouterRegistrationObjectListener implements IReceiverObjectListener {

    @Override
    public void acceptItem(Object itemId, Object item)
            throws ReceiverObjectListenerException, InvalidReceiverPipelineException, InvalidArgumentException {
        if (null == item) {
            throw new InvalidArgumentException("Item is null.");
        }

        if (null == itemId) {
            throw new InvalidReceiverPipelineException(
                    "Item identifier is null. The filter defining object address is missing or does not work correct.");
        }

        IMessageReceiver receiver;

        try {
            receiver = (IMessageReceiver) item;
        } catch (ClassCastException e) {
            throw new InvalidReceiverPipelineException(
                    "Item is not a message receiver.");
        }

        try {
            IRouter router = IOC.resolve(Keys.getOrAdd(IRouter.class.getCanonicalName()));

            router.register(itemId, receiver);
        } catch (ResolutionException e) {
            throw new ReceiverObjectListenerException(e);
        }
    }

}