- edited description
Subscribing ExternalComponent to PubSub Node
This is not an issue. I was unable to find appropriate channel to contact repo owner. So, I created this issue.
I am looking for information regarding use of Babbler for creating ExternalComponent that subscribes to PubSub Node. (PubSub Node already exist as it is created using configuration options provided with oracle messaging instant server https://docs.oracle.com/communications/E76289_01/doc.1001/e76291/im_mgng_im_msgs_ofln_usrs.htm#IMSAG548)
Please confirm if the below steps could work:
-> Create ExternalComponent using https://sco0ter.bitbucket.io/babbler/xep/externalcomponents.html
ExternalComponent myComponent = ExternalComponent.create("translation", "sharedSecret", "localhost", 5275);
-> Get Instance of pub-sub node ( I will not create node using pubSubNode.create(); as pubs node is already created using Configuration options provided with oracle messaging instant server)
PubSubNode pubSubNode = pubSubService.node("princely_musings”);
-> Subscribe to the node
pubSubNode.subscribe();
-> Listen for messages
myComponent.addInboundMessageListener(e -> {
Message message = e.getMessage();
Event event = message.getExtension(Event.class);
if (event != null) {
for (Item item : event.getItems()) {
// ...
}
}
});
Comments (9)
-
reporter -
repo owner I am not sure, if External Components can subscribe to PubSub nodes (because they are no user/account), but if they can, it should work this way you described.
-
reporter Thank You. Can you please elaborate on your comment (because they are no user/account),
-
repo owner External Components are just like plugins in a server deployment, but instead of "living" directly within the server environment/container and using the server's API directly, external components connect to the server via a TCP connection. External components have a component name, which is addressable through a subdomain: "componentname.serverdomain.xyz".
When a client sends message to "componentname.serverdomain.xyz", your external component will receive it. Components are also a allowed to send messages on behalf of user on the server.
That said, you could probably write a pubsub component with a component name "pubsub" to enhance your server with pubsub functionality served on "pubsub.yourserver.com". (Although I don't think it's really feasable in the long-term because you need a lot of the server's internals, like users and rosters).
That's what I meant with "they are no users", they are more like plugins to enhance your server with an additional service.
And actually I don't know, if they could (or should) subscribe to pubsub nodes. But maybe it's server dependent.
See also https://xmpp.org/extensions/xep-0114.html I also don't have much more information than what I found in XEP-114 and what I know from a few experiments with it.
-
reporter Thanks for the details. I see there is a connect method in ExternalComponent class that takes JID. Does it means JID of the component?
connect(Jid from)
But maybe it's server dependent. Yes, I guess its server dependent as the server documentation states that subscribe component to pubsub node.
-
repo owner No, the Jid is the "from" attribute of the (your) stream header. You usually don't need it (
null
) -
reporter Thank You. Please close this issue.
-
repo owner - changed status to resolved
-
repo owner - changed status to closed
- Log in to comment
updated description