public void invoke()

in chatterbox-xmpp/chatterbox-xmpp-impl/src/main/java/org/apache/tomee/chatterbox/xmpp/impl/XMPPResourceAdapter.java [350:388]


        public void invoke(Chat chat, Message message) {

            // This method will be invoked essentially each keystroke made by the remote user
            // We don't need to bother with this delivery logic until the user has pressed enter
            // and fully sent the message.
            if (message.getBody() == null) return;

            // This chat message object exists for clean logging.
            final ChatMessage chatMessage = new ChatMessage(chat, message);

            // find matching method(s)

            final List<Method> matchingMethods =
                    Arrays.asList(clazz.getDeclaredMethods())
                            .stream()
                            .sorted((m1, m2) -> m1.toString().compareTo(m2.toString()))
                            .filter(this::isPublic)
                            .filter(this::isNotFinal)
                            .filter(this::isNotAbstract)
                            .filter(m -> filterSender(chat.getParticipant(), m))
                            .filter(m -> filterMessage(message.getBody(), m))
                            .collect(Collectors.toList());

            if (matchingMethods == null || matchingMethods.size() == 0) {
                LOGGER.log(Level.INFO, "No method to match " + chatMessage);
                return;
            }

            if (this.clazz.isAnnotationPresent(InvokeAllMatches.class)) {
                for (final Method method : matchingMethods) {
                    LOGGER.log(Level.INFO, "Invoking method " + method.toString() + " for " + chatMessage);
                    invoke(method, chat.getParticipant(), message.getBody());
                }
            } else {
                final Method method = matchingMethods.get(0);
                LOGGER.log(Level.INFO, "Invoking method " + method.toString() + " for " + chatMessage);
                invoke(method, chat.getParticipant(), message.getBody());
            }
        }