/** * Publishes multiple events to the node. Same rules apply as in {@link #send(Item)}. * * In addition, if {@link ConfigureForm#isPersistItems()}=false, only the last item in the input * list will get stored on the node, assuming it stores the last sent item. * * @param items - The collection of {@link Item} objects being sent * @param <T> type of the items. * * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException * */ public <T extends Item> void publish(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub packet = createPubsubPacket(Type.set, new PublishItem<>(getId(), items)); pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow(); }
@Override public String toXML(String enclosingNamespace) { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); builder.append(" node='"); builder.append(getNode()); builder.append("'>"); for (Item item : items) { builder.append(item.toXML(null)); } builder.append("</publish>"); return builder.toString(); } }
@Override public String toXML() { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); builder.append(" node='"); builder.append(getNode()); builder.append("'>"); for (Item item : items) { builder.append(item.toXML()); } builder.append("</publish>"); return builder.toString(); } }
packet.addExtension(new PublishItem<>(nodeName, item)); pendingPublishRequests.put(packetID, nodeName); timeoutTimer.schedule(
@Override public String toXML() { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); builder.append(" node='"); builder.append(getNode()); builder.append("'>"); for (Item item : items) { builder.append(item.toXML()); } builder.append("</publish>"); return builder.toString(); } }
/** * Publishes multiple events to the node. Same rules apply as in {@link #publish(Item)}. * * In addition, if {@link ConfigureForm#isPersistItems()}=false, only the last item in the input * list will get stored on the node, assuming it stores the last sent item. * * This is an asynchronous call which returns as soon as the * packet has been sent. * * For synchronous calls use {@link #send(Collection) send(Collection))}. * * @param items - The collection of items being sent */ public <T extends Item> void publish(Collection<T> items) { PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); con.sendPacket(packet); }
@Override public String toXML() { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); builder.append(" node='"); builder.append(getNode()); builder.append("'>"); for (Item item : items) { builder.append(item.toXML()); } builder.append("</publish>"); return builder.toString(); } }
/** * Publishes multiple events to the node. Same rules apply as in {@link #send(Item)}. * * In addition, if {@link ConfigureForm#isPersistItems()}=false, only the last item in the input * list will get stored on the node, assuming it stores the last sent item. * * This is a synchronous call which will throw an exception * on failure. * * For asynchronous calls, use {@link #publish(Collection) publish(Collection))}. * * @param items - The collection of {@link Item} objects being sent * * @throws XMPPException */ public <T extends Item> void send(Collection<T> items) throws XMPPException { PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); SyncPacketSend.getReply(con, packet); }
/** * Publishes multiple events to the node. Same rules apply as in {@link #publish(Item)}. * * In addition, if {@link ConfigureForm#isPersistItems()}=false, only the last item in the input * list will get stored on the node, assuming it stores the last sent item. * * This is an asynchronous call which returns as soon as the * packet has been sent. * * For synchronous calls use {@link #send(Collection) send(Collection))}. * * @param items - The collection of items being sent */ public <T extends Item> void publish(Collection<T> items) { PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); con.sendPacket(packet); }
/** * Publishes multiple events to the node. Same rules apply as in {@link #publish(Item)}. * * In addition, if {@link ConfigureForm#isPersistItems()}=false, only the last item in the input * list will get stored on the node, assuming it stores the last sent item. * * This is an asynchronous call which returns as soon as the * packet has been sent. * * For synchronous calls use {@link #send(Collection) send(Collection))}. * * @param items - The collection of items being sent */ public <T extends Item> void publish(Collection<T> items) { PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); con.sendPacket(packet); }
/** * Publishes multiple events to the node. Same rules apply as in {@link #send(Item)}. * * In addition, if {@link ConfigureForm#isPersistItems()}=false, only the last item in the input * list will get stored on the node, assuming it stores the last sent item. * * This is a synchronous call which will throw an exception * on failure. * * For asynchronous calls, use {@link #publish(Collection) publish(Collection))}. * * @param items - The collection of {@link Item} objects being sent * * @throws XMPPException */ public <T extends Item> void send(Collection<T> items) throws XMPPException { PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); SyncPacketSend.getReply(con, packet); }
/** * Publishes multiple events to the node. Same rules apply as in {@link #send(Item)}. * * In addition, if {@link ConfigureForm#isPersistItems()}=false, only the last item in the input * list will get stored on the node, assuming it stores the last sent item. * * This is a synchronous call which will throw an exception * on failure. * * For asynchronous calls, use {@link #publish(Collection) publish(Collection))}. * * @param items - The collection of {@link Item} objects being sent * * @throws XMPPException */ public <T extends Item> void send(Collection<T> items) throws XMPPException { PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); SyncPacketSend.getReply(con, packet); }