private void processPackets() {
        List<InterceptedPacket> packets = new ArrayList<>(packetQueue.size());
        packetQueue.drainTo(packets);
        for (InterceptedPacket interceptedPacket : packets) {
            for (Map.Entry<String, Subscription> entry : subscribers.entrySet()) {
                boolean notify = false;
                String componentJID = entry.getKey();
                Subscription subscription = entry.getValue();

                if (subscription.isIncoming() == interceptedPacket.isIncoming() &&
                        subscription.isProcessed() == interceptedPacket.isProcessed()) {
                    Class<? extends Packet> packetClass = interceptedPacket.getPacketClass();
                    if (subscription.isPresenceEnabled() && packetClass == Presence.class) {
                        notify = true;
                    }
                    else if (subscription.isMessageEnabled() && packetClass == Message.class) {
                        notify = true;
                    }
                    else if (subscription.isIQEnabled() && packetClass == IQ.class) {
                        notify = true;
                    }
                }

                if (notify) {
                    try {
                        Message message = new Message();
                        message.setFrom(serverName);
                        message.setTo(componentJID);
                        Element childElement = message.addChildElement("copy",
                                "http://jabber.org/protocol/packet#event");
                        childElement.addAttribute("incoming", subscription.isIncoming() ? "true" : "false");
                        childElement.addAttribute("processed", subscription.isProcessed() ? "true" : "false");
                        childElement.addAttribute("date", XMPPDateTimeFormat.format(interceptedPacket.getCreationDate()));
                        childElement.add(interceptedPacket.getElement().createCopy());
                        // Send message notification to subscribed component
                        routingTable.routePacket(message.getTo(), message);
                    }
                    catch (Exception e) {
                        Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
                    }
                }
            }
        }
    }
Removes the subscription of the specified component.

@param componentJID the address of the component connected to the server.
xmppserver/src/main/java/org/jivesoftware/openfire/interceptor/PacketCopier.java