Issue
I want to edit SendMessage Operation Code in existing AWS SQS Connector(V1.0.7) and wanna to build this editable connector and use it in WSO2 EI 6.4.0.
Reason to edit existing Code: Unable to post incoming payload into AWS SQS Queue often. For more reference click here
Steps I followed:
- I just downloaded AWS SQS Connector (V1.0.7) from GitHub by using Download Zip Option.
- after unzipping it, i did
mvn clean install
by navigate to directory called "esb-connector-amazonsqs-org.wso2.carbon.connector.amazonsqs-1.0.7" - Build Successful by using Apache maven 3.8.4 and got zip file inside "target" directory.
- I have taken that zip file and unzipped it to add below code in Send Operation
Just adding Endpoint Timeout Error handling to existing http call.
<http method="post" uri-template="{uri.var.apiUrl}{+uri.var.httpRequestUri}">
<timeout>
<duration>60000</duration>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
After adding above code, I tried 2 ways.
i made it as zip file and one way is place that into target directory and did same maven build again once build successful. Modified code not exist when i review again, only existing code available, in SendMessage Operation
Another way is i directly used modified zip code and place it inside server(Connectors-->Add) which leads to below issue, Connector deployment is unsuccessful.
ERROR LOG:
[2022-01-21 12:25:05,159] ERROR {org.apache.synapse.deployers.LibraryArtifactDeployer} - Deployment of synapse artifact failed for synapse libray at : C:\Development_Avecto\WSo2EIServers\wso2ei-6.6.0\wso2ei-6.6.0\repository\deployment\server\synapse-libs\amazonsqs-connector-1.0.7.zip : Error while extracting Synapse Library : amazonsqs-connector-1.0.7.zip org.apache.synapse.SynapseException: Error while extracting Synapse Library : amazonsqs-connector-1.0.7.zip
at org.apache.synapse.libraries.util.LibDeployerUtils.extractSynapseLib(LibDeployerUtils.java:426)
at org.apache.synapse.libraries.util.LibDeployerUtils.createSynapseLibrary(LibDeployerUtils.java:65)
at org.apache.synapse.deployers.LibraryArtifactDeployer.deploy(LibraryArtifactDeployer.java:60)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:93)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: C:\Development_Avecto\WSo2EIServers\wso2ei-6.6.0\wso2ei-6.6.0\bin\..\wso2\tmp\libs\1642748105152amazonsqs-connector-1.0.7.zip\amazonsqs-connector-1.0.7\amazonSQS-config\component.xml (The system cannot find the path specified)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at org.apache.synapse.libraries.util.LibDeployerUtils.extract(LibDeployerUtils.java:469)
at org.apache.synapse.libraries.util.LibDeployerUtils.extractSynapseLib(LibDeployerUtils.java:424)
I know that this is not the right way to do it.
Can any WSO2 Experts guide me the way to edit existing connector code ,building it as connector in order to use the same?
Solution
Resolved above connector build issue and Now I can use custom built AWS SQS connector(V1.07) in WSO2 EI Server.
Steps:
- Open
sendMessage.xml
operation file directoryesb-connector-amazonsqs-org.wso2.carbon.connector.amazonsqs-1.0.7\src\main\resources\amazonSQS-message
- modified section like below.
- again goto directory
esb-connector-amazonsqs-org.wso2.carbon.connector.amazonsqs-1.0.7
wherepom.xml
resides - run
mvn clean install
in above directory. - after build successful, we can get
amazonsqs-connector-1.0.7.zip
file inside directoryesb-connector-amazonsqs-org.wso2.carbon.connector.amazonsqs-1.0.7\target
Answered By - Justin
Answer Checked By - Mildred Charles (JavaFixing Admin)