Search code examples
wso2-cep

WSO2 CEP 4.1.0 Event adaptor


I wrote a custom event adaptor and I have placed the jar in dropping folder, but the CLI does not show custom logging nor does it appear within the output adaptor.

I have read the 4.1.0 guide without success and tried to read the source code of:

http://dist.wso2.org/maven2/org/wso2/carbon/org.wso2.carbon.event.input.adaptor.email/1.0.1/


Solution

  • Perhaps the bundle which you put into dropins has not being activated.

    To check whether it's active, you can start the WSO2 CEP server on OSGI console mode as follows: Go to <CEP_HOME>/bin and execute command (assuming you're using Linux):

    ./wso2server.sh -DosgiConsole
    

    After the server has started, you will see the OSGI prompt.

    osgi>
    

    Then run type ss <bundle_name>

    For example:

    ss org.wso2.carbon.event.output.adapter.custom.websocket
    

    sample output:

    id  State       Bundle
    285 RESOLVED      org.wso2.carbon.event.output.adapter.custom.websocket_5.0.12.SNAPSHOT
    
    • Note that you do not need to specify the complete bundle name with version and all but specifying a part of the name would be sufficient.

    It will show you whether the bundle is ACTIVE or not.

    If it's not in ACTIVE state, you can diagnose your bundle using its ID. E.g.

    diag 285
    

    This will show you the list of missing imported packages.

    You can refer to [1] and [2] to learn about OSGI console commands.

    Then make sure to expose those using your bundle pom file. For example, refer to following portion of a pom file. It has exposed certain packages using the Export-Package element.

     <build>
              <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <extensions>true</extensions>
                    <configuration>
                        <instructions>
                            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                            <Bundle-Name>${project.artifactId}</Bundle-Name>
                            <Private-Package>
                                org.wso2.carbon.event.output.adapter.websocket.local.internal,
                                org.wso2.carbon.event.output.adapter.websocket.local.internal.*
                            </Private-Package>
                            <Export-Package>
                                !org.wso2.carbon.event.output.adapter.websocket.local.internal,
                                !org.wso2.carbon.event.output.adapter.websocket.local.internal.*,
                                org.wso2.carbon.event.output.adapter.websocket.local.*,
                            </Export-Package>
                            <Import-Package>
                                org.wso2.carbon.event.output.adapter.core.*,
                                javax.xml.namespace; version=0.0.0,
                                *;resolution:=optional,
                            </Import-Package>
                            <DynamicImport-Package>*</DynamicImport-Package>
                        </instructions>
                    </configuration>
                </plugin>
              </plugins>
          </build>
    

    [3] might have some useful info too.

    References

    [1] http://movingaheadblog.blogspot.com/2014/01/how-to-debug-wso2-carbon-products-using.html

    [2] https://isurues.wordpress.com/2009/01/01/useful-equinox-osgi-commands

    [3] http://wso2.com/library/articles/getting-started-wso2-carbon/