cancel
Showing results for 
Search instead for 
Did you mean: 

Custom receiver Adapter deployed on CPI tenant gives error when used in Integration Flow

0 Kudos

Hello Experts,

Hope you are doing well!

I created a customer receiver adapter in CPI which would just return the value provided in the link field on the front end UI.(Logic will be something else but for now i am just trying to Print a value provided in the front end as the adapter output). Screenshot attched ui.png .

Below is the code for endpoint and Producer Java.:-

Endpoint.JAVA:-

/**

* Represents a www.Sample.com Camel endpoint.

*/

@UriEndpoint(scheme = "sap-sample", syntax = "", title = "")

public class word1Endpoint extends DefaultPollingEndpoint {

private word1Component component;

private transient Logger logger = LoggerFactory.getLogger(word1Endpoint.class);

@UriParam

private String greetingsMessage;

public String getGreetingsMessage() {

return greetingsMessage;

}

public void setGreetingsMessage(String greetingsMessage) {

this.greetingsMessage = greetingsMessage;

}

@UriParam

private String link;

public String getlink() {

return link;

}

public void setlink(String link) {

this.link = link;

}

public word1Endpoint() {

}

public word1Endpoint(final String endpointUri, final word1Component component) throws URISyntaxException {

super(endpointUri, component);

this.component = component;

//this.link=endpointUri;

}

public word1Endpoint(final String uri, final String remaining, final word1Component component) throws URISyntaxException {

this(uri, component);

//this.link=remaining;

}

public Producer createProducer() throws Exception {

return new word1Producer(this);

}

public Consumer createConsumer(Processor processor) throws Exception {

final word1Consumer consumer = new word1Consumer(this, processor);

configureConsumer(consumer);

return consumer;

}

public boolean isSingleton() {

return true;

}

}


Producer.java Code:-

package word1;

import org.apache.camel.Exchange;

import org.apache.camel.impl.DefaultProducer;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

/**

* The www.Sample.com producer.

*/

public class word1Producer extends DefaultProducer {

private static final transient Logger LOG = LoggerFactory.getLogger(word1Producer.class);

private word1Endpoint endpoint;

public word1Producer(word1Endpoint endpoint) {

super(endpoint);

this.endpoint = endpoint;

this.endpoint.setlink(this.endpoint.getlink());

}

@Override

protected void doStart() throws Exception {

super.doStart();

}

//public void process(final Exchange exchange) throws Exception {

public void process(final Exchange exchange) throws Exception {

String input = exchange.getIn().getBody(String.class);

//String greetingMessage = endpoint.getGreetingsMessage();

String greetingMessage = endpoint.getlink();

if(greetingMessage == null || greetingMessage.isEmpty()) {

greetingMessage = "shub";

}

String messageInUpperCase = greetingMessage.toUpperCase();

exchange.getIn().setBody(messageInUpperCase);

}

}

The Adapter gets deployed on the tenant but when used in integration flow and executed, it fails with the below error:-


[CAMEL][IFLOW][EXCEPTION] : org.apache.camel.FailedToCreateRouteException: Failed to create route Process_1 at: >>> To[sap-sample:foo?link=shubham] <<< in route: Route(Process_1)[[From[direct:test_A_TimerEventDefinition_14... because of Failed to resolve endpoint: sap-sample://foo?link=shubham due to: Failed to resolve endpoint: sap-sample://foo?link=shubham due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{link=shubham}] [CAMEL][IFLOW][CAUSE] : Cause: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: sap-sample://foo?link=shubham due to: Failed to resolve endpoint: sap-sample://foo?link=shubham due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{link=shubham}] [CAMEL][IFLOW][CAUSE] : Cause: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: sap-sample://foo?link=shubham due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{link=shubham}]


I am really not sure where am in going Wrong in this.

Please have a look and suggest if i am missing something here.

Thanks,
Shubham

former_member37947
Participant
0 Kudos

Did you solved this issue?

I´m getting a similar error

Thanks in advance.

Accepted Solutions (0)

Answers (0)