Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions custom-artifacts/inbound-endpoint/custom_inbound_event_based/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.synapse.inbound</groupId>
<artifactId>custom-event-based-inbound-consumer</artifactId>
<version>1.0.0</version>
<name>Custom Event based inbound consumer Sample</name>
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>4.0.0-wso2v268</version>
</dependency>
<dependency>
<groupId>org.wso2.ei</groupId>
<artifactId>org.wso2.micro.integrator.inbound.endpoint</artifactId>
<version>4.5.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>wso2-maven2-repository</id>
<url>http://dist.wso2.org/maven2</url>
</repository>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>atlassian-contrib</id>
<url>https://maven.atlassian.com/contrib</url>
</repository>
<repository>
<id>atlassian-proxy</id>
<url>https://maven.atlassian.com/repository/public</url>
</repository>
<repository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>wso2-nexus</id>
<name>WSO2 internal Repository</name>
<url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
<repository>
<id>wso2</id>
<name>WSO2 internal Repository</name>
<url>http://dist.wso2.org/maven2/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>

<repository>
<id>wso2.snapshots</id>
<name>WSO2 Snapshot Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<filters>
<filter>${basedir}/src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/zip-assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>wso2-maven2-repository</id>
<name>WSO2 Maven2 Repository</name>
<url>scp://dist.wso2.org/home/httpd/dist.wso2.org/maven2/</url>
</repository>
</distributionManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
custom.inbound.groupId=${project.groupId}
custom.inbound.artifactId=${project.artifactId}
custom.inbound.version=${project.version}

#Add any dynamic parameters you defined in descriptor.yml here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.1 http://maven.apache.org/xsd/assembly-2.1.1.xsd">
<id>bundle</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include> <!-- Include the JAR file generated by the build -->
</includes>
</fileSet>
</fileSets>
<files>
<file>
<source>src/main/resources/uischema.json</source>
<outputDirectory>/resources</outputDirectory>
</file>
<file>
<source>src/main/resources/connector.xml</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>src/main/resources/descriptor.yml</source>
<outputDirectory>/</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.inbound.custom.event;

import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.core.SynapseEnvironment;
import org.wso2.carbon.inbound.endpoint.protocol.generic.GenericEventBasedConsumer;

public class SampleEventBasedInboundConsumer extends GenericEventBasedConsumer {

private static final Log log = LogFactory.getLog(SampleEventBasedInboundConsumer.class);

/**
* @param properties
* @param name
* @param synapseEnvironment
* @param injectingSeq
* @param onErrorSeq
* @param coordination
* @param sequential
*/
public SampleEventBasedInboundConsumer(Properties properties, String name, SynapseEnvironment synapseEnvironment,
String injectingSeq, String onErrorSeq, boolean coordination, boolean sequential) {
super(properties, name, synapseEnvironment, injectingSeq, onErrorSeq, coordination, sequential);
log.info("Initialized the busy waiting consumer.");
}

/**
* Start listening for incoming events on the inbound endpoint.
* <p>
* This is the main entry point that activates the event listener and begins processing
* incoming events from the configured source.
*/
@Override
public void listen() {
//TODO: Implement logic to start listening for events
log.info("Inside the listen method. Starting to listen for events.");
}

/**
* Gracefully suspend event processing.
* <p>
* pause() temporarily halts the processing of incoming events without destroying the connection
* or releasing resources, allowing the endpoint to resume event processing later.
*/
@Override
public void pause(){
//TODO: Implement logic to gracefully suspend event processing
log.info("Inside the pause method. Gracefully suspending event processing.");
}

/**
* Implement resume() method to enable dynamic lifecycle control (activate/deactivate) of the inbound endpoint.
* <p>
* resume() should re-establish the connections and restore the endpoint to an active state.
* <p>
* Note: While resume() and destroy() methods are loosely coupled, ensure that resume() performs all necessary
* restoration actions corresponding to the cleanup performed in destroy().
*/
@Override
public void resume(){
//TODO: Implement logic to restore endpoint to active state
log.info("Inside the resume method. Restoring the event-based inbound endpoint.");
}

/**
* Completely shut down the event listener and release all resources.
* <p>
* destroy() terminates event listening, closes all connections, and releases allocated resources.
* <p>
* Note: destroy() is coupled with resume() to enable dynamic control of event-based inbound endpoint.
*/
@Override
public void destroy() {
//TODO: Implement logic to terminate event listening and release resources
log.info("Inside the destroy method. Terminating event listening and releasing resources.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2025, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.

WSO2 LLC. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<connector>
<component name="SampleEventBasedInboundConsumer" package="org.wso2.integration.inbound" >
<description>WSO2 Sample Event-based Inbound Endpoint</description>
</component>
</connector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Connector Descriptor File
# Specifies the dependencies and repositories required for the connector.
# The values are parameterized for customization and will be referenced during the build process from filter.properties.

dependencies:
- groupId: "${custom.inbound.groupId}"
artifactId: "${custom.inbound.artifactId}"
version: "${custom.inbound.version}"

repositories:
- id: "wso2-nexus"
url: "https://maven.wso2.org/nexus/content/groups/wso2-public/"
Loading