Describe the bug I added a new test component method by https://docs.tigase.net/tigase-server/master-snapshot/Development_Guide/html/#cil1 The service can be discoveryed but it can not be used.The error dialog said 'Feature not implemented'
To Reproduce Steps to reproduce the behavior:
Impact Can not use test component.
Expected behavior Can use test component.
Screenshots
Details (please complete the following information):
Component Class
package com.xxxxx.zigase.test; import java.util.logging.Logger; import tigase.component.AbstractKernelBasedComponent; import tigase.kernel.beans.Bean; import tigase.kernel.core.Kernel; @Bean(name = "muc", parent = Kernel.class, active = true) public class TestComponent extends AbstractKernelBasedComponent { private static final Logger log = Logger.getLogger(TestComponent.class.getName()); @Override public String getComponentVersion() { String version = this.getClass().getPackage().getImplementationVersion(); return version == null ? "0.0.0" : version; } @Override public boolean isDiscoNonAdmin() { return false; } @Override protected void registerModules(Kernel kernel) { // here we need to register modules responsible for processing packets } }
ModuleClass:
package com.xxxxx.zigase.test.modules; import com.xxxxx.zigase.test.TestComponent; import tigase.component.exceptions.ComponentException; import tigase.component.modules.AbstractModule; import tigase.criteria.Criteria; import tigase.criteria.ElementCriteria; import tigase.kernel.beans.Bean; import tigase.server.Packet; import tigase.util.stringprep.TigaseStringprepException; import java.util.logging.Logger; @Bean(name = "test-module", parent = TestComponent.class, active = true) public class TestModule extends AbstractModule { private static final Logger log = Logger.getLogger(TestModule.class.getCanonicalName()); private static final Criteria CRITERIA = ElementCriteria.name("message"); @Override public Criteria getModuleCriteria() { return CRITERIA; } @Override public void process(Packet packet) throws ComponentException, TigaseStringprepException { log.finest("My packet: " + packet.toString()); } }
config.tdsl:
test(class: com.xxxxx.zigase.test.TestComponent) { }
In order for the component to properly respond to disco#info and disco#items request you should register DiscoveryModule in your component:
disco#info
disco#items
DiscoveryModule
@Override protected void registerModules(Kernel kernel) { kernel.registerBean("disco").asClass(DiscoveryModule.class).exec(); }
NOTE It's essential to explicitly register DiscoveryModule in your component.
@woj-tek OK thanks!
Describe the bug I added a new test component method by https://docs.tigase.net/tigase-server/master-snapshot/Development_Guide/html/#cil1 The service can be discoveryed but it can not be used.The error dialog said 'Feature not implemented'
To Reproduce Steps to reproduce the behavior:
Impact Can not use test component.
Expected behavior Can use test component.
Screenshots
Details (please complete the following information):