I am trying to configure multiple Camel Salesforce components in the same camel context. As I need to connect two different salesforce instances.
I know in order to configure another instance, we can simply create a new bean with a different name and it can then be used in endpoint configurations.
I got one configured via standard properties configurations and the second one is configured using a bean with different properties.
But on startup my second bean configurations get overwritten by main components configurations in SalesforceComponentConfigurer class.
Is there any way to stop configurer to ignore the second component?
#Bean("salesforce-target")
public SalesforceComponent targetSalesforceComponent(#Autowired CamelContext camelContext) {
SalesforceComponent targetComponent = new SalesforceComponent(camelContext);
targetComponent.setClientId(clientId);
targetComponent.setClientSecret(clientSecret);
targetComponent.setUserName(userName);
targetComponent.setPassword(password);
targetComponent.setLoginUrl(loginUrl);
targetComponent.setLazyLogin(true);
targetComponent.setAuthenticationType(AuthenticationType.USERNAME_PASSWORD);
return targetComponent;
}
I am working on a project and I am forced to not using Spring Boot. I have a Eureka server running on localhost:8090 and some services already registered on it.
How can I force Apache Camel's serviceCall to look for services on the Eureka server?
I know that to make it work for Consul as the service discovery you should do something like following:
ConsulConfiguration config = new ConsulConfiguration();
config.setUrl("http://ip:port");
ConsulServiceDiscovery discovery = new ConsulServiceDiscovery(config);
// configure camel service call
ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition();
//config.setServiceDiscovery(servers);
// register configuration
camelContext.setServiceCallConfiguration(config);
How to make it work for Eureka server on localhost:8090??
there’s no direct support for eureka in camel so if you can’t use spring-boot, you need to build your own ServiceDiscovery implementation
As #Luca suggested and after some research I came to this conclusion that you should implement a custom service discovery to read from Eureka. In order to do that I did the following:
Extending my EurekaServiceDiscovery class from DefaultServiceDiscovery class of camel-core module
Overriding the method public List getServices(String name) of
DefaultServiceDiscovery class which is responsible to retrieve services from Eureka
Using Eureka REST API to get all the services in the overrided method. In order to do this you should convert the recieved JSON data from Eureka REST API to appropriate java classes. You need to define Application and InstanceInfo classes based on those JSON data.
For example after running Eureka on localhost:8090 and after registering a service named account-service on it, you can git information of account-service by sending a Http.GET request to localhost:8090/eureka/apps/account-service
For more info look at this Github repo: https://github.com/hamedmirzaei/service-gateway-bootless
Trying to integrate Camel+ Guice and JNDI. We have batch job which already uses Guice for Dependency Injection. We are Switching to Camel for Integration and decided to uses camel-guice component.
I have configured DataSource as provider binding in Guice Module. This module is bootstrapped through jndi.properties file in classpath
#Provides
#JndiBind("jdbc/dbName")
#Singleton
public DataSource congigureDataSource() {
//Actual code for creating DataSource
}
There is existing code which looks up the DataSource through JNDI api.
Context ctx = new InitialContext();
DateSource dx = (DataSource)ctx.lookup("jdbc/dbName");
//DB connection and query code goes here
The above code triggers an infinite recursion in GuiceInitialContextFactory in the method getInitialContext. i.e This method being called again and again
Just want to check if i'have configured everything correctly or something is missing. Is the approach correct.
I am trying to transfer data in the form of objects between a gwt client and the app engine server. The objects i transfer need to be persistable (a blog comment for example). as it turns out AppEngine is uncomfortable to include those persistable objects (annotated as #PersistenceCapable) in the gwt module, because the gwt client cant store such date. Also the gwt client cant call a remote procedure with objects which are not concrete. So there is not the option to define interfaces for accessing those classes.
In short:
GWT Client cant work with interfaces, but also not with persistable annotated classes.
My Question is: how can i design an application which transfers stored data between the gwt client and the appengine. This is currently a real problem for me. it seems to me as if the only option is a DataTransferObejct which is just pure sensless code doing the exact thing the data-objects do: storing data.
I used the appengine.datastore Key for the id's of the classes.
Any suggestions ? Or am i getting something wrong ?
What version of GWT are you using? I regularly share data between GWT and GAE using serializable POJOs annotated PersistenceCapable. If you are using Key key, use Long id instead to get it working.
I'm trying to use Guice to inject properties of a JSF managed bean. This is all running on Google App Engine (which may or may not be important)
I've followed the instructions here:
http://code.google.com/docreader/#p=google-guice&s=google-guice&t=GoogleAppEngine
One problem is in the first step. I can't subclass the Servlet module and setup my servlet mappings there because Faces is handled by the javax.faces.webapp.FacesServlet which subclasses Servlet, not HttpServlet. So, I tried leaving my servlet configuration in the web.xml file and simply instantiating a new ServletModel() along with my business module when creating the injector in the context listener described in the second step.
Having done all that, along with the web.xml configuration, my managed bean isn't getting any properties injected. The method is as follows
#ManagedBean
#ViewScoped
public class ViewTables implements Serializable
{
private DataService<Table> service;
#Inject
public void setService( DataService<Table> service )
{
this.service = service;
}
public List<Table> getTables()
{
return service.getAll();
}
}
So, I'm wondering if there is a trick to get Guice injecting into a JSF managed bean? I obviously can't use the constructor injection because JSF needs a no-arg constructor to create the bean.
Check the following JSF-Guice integration framework/advice:
http://code.google.com/p/jsf-sugar/
http://notdennisbyrne.blogspot.com/2007/09/integrating-guice-and-jsf.html
http://cagataycivici.wordpress.com/2007/03/26/integrating_guice_and_jsf/
http://snippets.dzone.com/posts/show/7171
You can also create an HTTP servlet that then simple delegates the request on to a FacesServlet (like a wrapper). This should give you the same effect using Guice Servlet.
How about this approach, works well for us:
http://uudashr.blogspot.com/2008/12/guicing-jsf-with-guice.html
being the developer of jsf sugar I really would like to know the problem you had using it. We are already using it in production here so there shouldn't be any "show stoppers", maybe something is just not well documented? Just drop me a mail: murbanek(at)gmx_net (replace the _ with a .) .
check out http://code.google.com/p/guice2jsf/, and website starchu.blogspot.com, it has excellent library that provides Guice and JSF 2.0 integration
As information in this post are getting out of date but the question is still relevant, I'd like to share my findings about this topic. I wrote a little tutorial including a runnable sample project on how to setup a fully guice powered web stack. You can find it here: https://github.com/skuzzle/guice-jsf