Search code examples
javajbossapache-camelsalesforce

Understanding Difference between Fuse and Camel for Salesforce Integration


I am trying to learn how to carry salesforce integration but I'm finding the documentation in the area very lacking. I have a very simple route which I am trying to test using camel only.

This is my route:

 public void configure() throws Exception {
            from("salesforce:query?sObjectQuery="+myQuery)
                .log(body().toString());
 }

For some reason, I get the following error when running my this route and I get a very minimal error message with little to no useful information. The error is

Failed to create route route1: Route(route1)[[From[salesforce:query?sObjectQuery]] -> [SetB... because of Failed to resolve endpoint: salesforce://query?sObjectQuery= due to: Cannot auto create component: salesforce

When searching the error, I only found that this error is normally caused by a missing dependency for the salesforce connector inside the pom. But I have this dependency and also see the camel-salesforce.jar in the classpath of my project.

I have researched for working examples of salesforce with Camel and I have barely found anything. I found some examples using JBoss Fuse. But I cannot understand what the difference between JBoss Fuse and Camel is and why Jboss is needed. Do I require Jboss fuse in order to carry out salesforce integration with camel? Or should camel alone be enough to run my code? What's the point of JBoss Fuse and should I be using it?

I'm finding documentation of the salesforce connector of camel to be very lacking and therefore I would greatly appreciate any information on this error and on the difference between JBoss fuse and Camel


Solution

  • I found the solution of this. You need to define a component with a SalesforceLoginConfig and add this component must then be added to the camel context. The camel salesforce documentation doesn't mention this anywhere and it really should be added to save people the time.

                SalesforceComponent component = new SalesforceComponent();
                final SalesforceEndpointConfig config = new SalesforceEndpointConfig();
                config.setApiVersion(System.getProperty("apiVersion", "28.0"));
                component.setConfig(config);
    
                SalesforceLoginConfig loginConfig = new SalesforceLoginConfig();
                loginConfig.setClientId("clientId");
                loginConfig.setClientSecret("ClientSecret");
                loginConfig.setUserName("username");
                loginConfig.setPassword("password");
                loginConfig.setLoginUrl("url");
                component.setLoginConfig(loginConfig);
                context.addComponent("salesforce", component);