Tigase Forums

API and development: RE: Stopping a component

Tigase XMPP Server Board - Fri, 11/17/2017 - 09:33

It's described in the documentation http://docs.tigase.org/tigase-server/snapshot/Development_Guide/html_chunk/cil8.html:

Stopping a component
Component instance may be stopped at any point of Tigase XMPP Server runtime, ie. due to reconfiguration, or due to server graceful shutdown.

In both cases following methods of a component will be called:

void stop() - first method stops component internal processing queues.
void beforeUnregister() (optional) - if component implements UnregisterAware interface this method is called to notify instance of a component that it is being unloaded.
void unregister(Kernel kernel) (optional) - if component implements RegistrarBean called to give component a way to unregister beans (if needed).

So to answer your question - the method will be called before stopping the component instance but not necessarily server.

You can use method tigase.sys.TigaseRuntime#addShutdownHook() to add your custom hook, which will be executed during server shutdown.

Categories: Tigase Forums

API and development: RE: Stopping a component

Tigase XMPP Server Board - Wed, 11/15/2017 - 01:08

how can I call my method before shutting down the server?

Categories: Tigase Forums

API and development: Stopping a component

Tigase XMPP Server Board - Tue, 11/14/2017 - 01:13

Does the method stop() work before shutting down the server (tigase-server-8.0.0-SNAPSHOT-b5058)?

Categories: Tigase Forums

API and development: RE: Packet.getStanzaFrom() NoSuchMethodError

Tigase XMPP Server Board - Tue, 11/07/2017 - 17:38

Yes, it was a version mismatch. Fixed it. Thank you.

Categories: Tigase Forums

API and development: RE: Packet.getStanzaFrom() NoSuchMethodError

Tigase XMPP Server Board - Sat, 11/04/2017 - 01:53

Recently we moved classes JID and BareJID from package tigase.xmpp to package tigase.xmpp.jid. Looking at your error it looks like you are developing your component using newest snapshot build of Tigase XMPP Server, which has JID and BareJID already moved but you are starting component on the server where an older version of Tigase XMPP Server is deployed (build from before the move).

Please try to upgrade your installation to newest snapshot build of Tigase XMPP Server and this should solve this error.

Categories: Tigase Forums

API and development: Packet.getStanzaFrom() NoSuchMethodError

Tigase XMPP Server Board - Fri, 11/03/2017 - 20:40

I'm writing a Component, and have been getting errors with JIDs. Here I'm trying to find out who a packet is from, so I can do a thing.

@Override
public void processPacket(Packet packet) {
if(packet.getStanzaFrom().toString().equals(myUsername)){
// Do my thing.
}
}

When I run this Component, and send it a packet, I get the following error:

2017-11-03 22:52:16.315 [in_0-tigase-remote-component] ThreadExceptionHandler.uncaughtException() SEVERE: Uncaught thread: "in_0-tigase-remote-component" exception
java.lang.NoSuchMethodError: tigase.server.Packet.getStanzaFrom()Ltigase/xmpp/jid/JID;
at TigaseRemoteComponent.processPacket(TigaseRemoteComponent.java:18)
at tigase.server.AbstractMessageReceiver$QueueListener.run(AbstractMessageReceiver.java:1570)

Why can't it find the Packet.getStanzaFrom() method?

Categories: Tigase Forums

API and development: RE: Developing with IntelliJ?

Tigase XMPP Server Board - Sun, 10/29/2017 - 14:01

This is what I added to the POM file to get it working:

<dependencies><dependency>
<groupId>tigase</groupId>
<artifactId>tigase-server</artifactId>
<version>8.0.0-SNAPSHOT</version>
</dependency></dependencies>
<repositories>
<repository>
<id>tigase</id>
<name>Tigase repository</name>
<url>http://maven-repo.tigase.org/repository/release&lt;/url>
</repository>
<repository>
<id>tigase-snapshot</id>
<name>Tigase repository</name>
<url>http://maven-repo.tigase.org/repository/snapshot&lt;/url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

Categories: Tigase Forums

API and development: RE: Developing with IntelliJ?

Tigase XMPP Server Board - Tue, 10/24/2017 - 10:45

Thanks. I'll read the Maven guide and ignore those IDEA errors.

Categories: Tigase Forums

API and development: RE: Developing with IntelliJ?

Tigase XMPP Server Board - Tue, 10/24/2017 - 07:45

Thanks. I'll read the Maven guide and ignore those IDEA errors.

Categories: Tigase Forums

API and development: RE: Developing with IntelliJ?

Tigase XMPP Server Board - Tue, 10/24/2017 - 02:22

Wojciech already told you that you need to create your own Maven project and which lines you need to add as a dependency. However, you need to add them in the correct place within XML structure. For that, I would recommend consulting with Maven documentation, see guides and documentation at http://maven.apache.org/guides/

As for our project XML, lines marked as containing errors within IDEA are correct, but IDEA is not aware of additional variables which we defined within maven project and due to that it reports errors.

Categories: Tigase Forums

API and development: RE: Developing with IntelliJ?

Tigase XMPP Server Board - Mon, 10/23/2017 - 23:22

Wojciech already told you that you need to create your own Maven project and which lines you need to add as a dependency. However, you need to add them in the correct place within XML structure. For that, I would recommend consulting with Maven documentation, see guides and documentation at http://maven.apache.org/guides/

As for our project XML, lines marked as containing errors within IDEA are correct, but IDEA is not aware of additional variables which we defined within maven project and due to that it reports errors.

Categories: Tigase Forums

API and development: RE: Developing with IntelliJ?

Tigase XMPP Server Board - Fri, 10/20/2017 - 20:15

Thanks for your help so far. I've cloned the 8.0.0-SNAPSHOT code to a folder. If I open that folder with IntelliJ, I am told the POM file contains errors on the following lines:

<dist-dir>${myproject.basedir}/distribution-packages/</dist-dir> Cannot resolve myproject.basedir <finalName>${project.artifactId}-${gitVersion}</finalName> Cannot resolve gitVersion <autoVersionSubmodules>true</autoVersionSubmodules> autoVersionSubmodules is not allowed here
I have tried creating a new project (as you suggested) and adding the dependency (as you wrote it above) to the POM file, but that results in a very large error message that looks like this:
Invalid content was found starting with element dependency... Then lots of URLs.

What do I try next? Or can you explain how to create a new project and add your code as a dependency step-by-step?

Thanks.

Categories: Tigase Forums

API and development: RE: Developing with IntelliJ?

Tigase XMPP Server Board - Fri, 10/20/2017 - 17:15

Thanks for your help so far. I'm a new programmer, and I'm used to Android Studio, which is pre-configured and uses Gradle to build, so this is particularly frustrating.
I've cloned the 8.0.0-SNAPSHOT code to a folder. If I open that folder, the POM file contains errors on the following lines:

<dist-dir>${myproject.basedir}/distribution-packages/</dist-dir> Cannot resolve myproject.basedir
<finalName>${project.artifactId}-${gitVersion}</finalName> Cannot resolve gitVersion
<autoVersionSubmodules>true</autoVersionSubmodules> autoVersionSubmodules is not allowed here

In Android Studio (which is just a highly configured version of IntelliJ), I just add something like this to my gradle.build file:
repositories {
mavenCentral()
}
dependencies {
compile('com.example.examplesdk:example-tigase-sdk:1.2.3')
}

And that's it. Is there some equivalent thing I can do with Maven?

I have tried creating a new project, as you suggested, and adding the dependency (as you wrote it above) to the POM file, but that results in a very large error message that looks like this:
Invalid content was found starting with element dependency... Then lots of URLs.

What do I try next?

Categories: Tigase Forums

API and development: RE: supElementNamePaths not working correctly in Postprocessor

Tigase XMPP Server Board - Fri, 10/20/2017 - 05:04

Yes, in this case, implementation of those methods has no effect.

Categories: Tigase Forums

API and development: RE: supElementNamePaths not working correctly in Postprocessor

Tigase XMPP Server Board - Fri, 10/20/2017 - 05:02

Ok. I simply looked at this code as a base to implement my own postProcessor:

https://github.com/kontalk/tigase-extension/blob/master/src/main/java/org/kontalk/xmppserver/KontalkPushNotifications.java

As you can see, they also use supElementNamePaths to filter only message elements. But their postProcessor method also checks to make sure the element is a message. So it means that the supElementNamePaths and supNameSpaces they are using have no effect?

Categories: Tigase Forums

API and development: RE: supElementNamePaths not working correctly in Postprocessor

Tigase XMPP Server Board - Fri, 10/20/2017 - 04:41

Interfaces XMPPPreprocessorIfc and XMPPPostprocessorIfc, do not have methods supNamespaces() and supElementNamePaths() defined and as a result they are not supported. In methods like preProcess() and postProcess() you will receive every packet which is processed without any filters, so you need to filter those packets on your own.

Methods supNamespaces() and supElementNamePaths() are part of XMPPProcessor interface and are used to filter only packets being delivered to process() method.

Categories: Tigase Forums

Pages

Get in touch

We provide software products, consulting and custom development services

Tigase, Inc.
100 Pine Street, Suite 1250
San Francisco, CA 94111, USA
Phone: (415) 315 9771

Follow us on:

Twitter

Back to Top