Getting component JID

Teemu K
Added about 5 years ago

I'm building a subsystem for the tigase server that includes a component and a SessionManager plugin that routes the desired Packets to the component. In order to do this, the plugin needs to set the destination JID in the Packet to the component's JID. I can see the component references are held in the MessageRouter class, but I cannot see how to access that from the plugin process() method. What is the idiomatic way to do this in tigase? Do I add the component's full JID in the settings file and then construct a JID instance from that?

Replies (1)

Added by Wojciech Kapcia TigaseTeam about 5 years ago

You can use following code to construct component address:

String defHost = DNSResolver.getDefaultHostname();
JID cmpAddr = JID.jidInstanceNS("cmp@" + defHost);

Same approach is used in AMP (which also contains a component and plugin that forwards messages to this component).