public void routingFailed( JID recipient, Packet packet )
    {
        log.debug( "Message sent to unreachable address: " + packet.toXML() );
        final Message msg = (Message) packet;

        if ( msg.getType().equals( Message.Type.chat ) && serverName.equals( recipient.getDomain() ) && recipient.getResource() != null ) {
            // Find an existing AVAILABLE session with non-negative priority.
            for (JID address : routingTable.getRoutes(recipient.asBareJID(), packet.getFrom())) {
                ClientSession session = routingTable.getClientRoute(address);
                if (session != null && session.isInitialized()) {
                    if (session.getPresence().getPriority() >= 0) {
                        // If message was sent to an unavailable full JID of a user then retry using the bare JID.
                        routingTable.routePacket(recipient.asBareJID(), packet);
                        return;
                    }
                }
            }
        }

        if ( serverName.equals( recipient.getDomain() ) )
        {
            // Delegate to offline message strategy, which will either bounce or ignore the message depending on user settings.
            log.trace( "Delegating to offline message strategy." );
            messageStrategy.storeOffline( (Message) packet );
        }
        else
        {
            // Recipient is not a local user. Bounce the message.
            // Note: this is similar, but not equal, to handling of message handling to local users in OfflineMessageStrategy.

            // 8.5.2.  localpart@domainpart
            // 8.5.2.2.  No Available or Connected Resources
            if (recipient.getResource() == null) {
                if (msg.getType() == Message.Type.headline || msg.getType() == Message.Type.error) {
                    // For a message stanza of type "headline" or "error", the server MUST silently ignore the message.
                    log.trace( "Not bouncing a message stanza to a bare JID of non-local user, of type {}", msg.getType() );
                    return;
                }
            } else {
                // 8.5.3.  localpart@domainpart/resourcepart
                // 8.5.3.2.1.  Message

                // For a message stanza of type "error", the server MUST silently ignore the stanza.
                if (msg.getType() == Message.Type.error) {
                    log.trace( "Not bouncing a message stanza to a full JID of non-local user, of type {}", msg.getType() );
                    return;
                }
            }

            bounce( msg );
        }
    }
Notification message indicating that a packet has failed to be routed to the recipient.

@param recipient address of the entity that failed to receive the packet.
@param packet    Message packet that failed to be sent to the recipient.
xmppserver/src/main/java/org/jivesoftware/openfire/MessageRouter.java