class MessageDispatcher {

    public void handle(String messageId, JsonValue content) throws NotFoundException, PredicateNotMetException {
        Reject.ifNull(content);
        Reject.ifNull(messageId);
        MessagePromise messagePromise = cache.getIfPresent(messageId);
        if (messagePromise != null) {
            for (Predicate p : messagePromise.getPredicates()) {
                if (!p.perform(content)) {
                    throw new PredicateNotMetException("Predicate was not matched. Message invalid.");
                }
            }

            messagePromise.getPromise().tryHandleResult(content);
            cache.invalidate(messageId);
        } else {
            debug.warning("Cache was asked to handle {} but never expected it.", messageId);
            throw new NotFoundException("This cache was not primed for this messageId.");
        }
    }

    @Inject public  MessageDispatcher(Cache<String, MessagePromise> dispatch, @Named("frPush") Debug debug);

}