How to remove Ribbon Load Balancing from #FeignClient - spring-boot

I need to disable #FeignClient from using Ribbon Loadbalancer. I tried it by avoid configuring name field of the annotation and gave only url. But with the latest version of open feign, it's mandatory to give name or value fields. Can anyone explain the exact use of these fields and a way to eliminate #FeignClient from using ribbon load balancing?
Open Feign
Exception:
java.lang.IllegalStateException: Either 'name' or 'value' must be provided in #FeignClient

Related

Spring Config Server with Spring Boot Properties

I am storing application.properties file in my config server. And my client applications are refering config server to download the property files.
Scenario 1:
When i change the value of property server.port in my config server. Can i reflect the changes in my client applicaiton without restarting the application.
You can use #RefreshScope beans for this purpose, this is not ideal but as close as you can get in config server, this is a pretty advanced thing after all.
So beans marked with this annotations will cause spring to clear the internal cache of the beans / configuration classes upon EnvironmentChangeEvent, then the instance of the bean will be created next time you'll try to call this bean.
To trigger such an event when the config server changes you can either explicitly call the actuator's refresh enpoint or develop your own solution that might be based on some messaging system so that the config server will be a producer of a "change" message and the consumer will be your application.
Now I can't say for sure whether it will work in particular with server.port, I've personally never seen a need to change this property, but for your custom beans this method will do the job.
Here is a good tutorial about this topic

How Spring gets data-source reference from server using JNDI

As we all know we can get a data-source reference or any JNDI reference from server using InitialContextFactory
Ex. When it comes to Websphere Application Server using below properties we can get reference:
com.ibm.websphere.naming.WsnInitialContextFactory
corbaloc:iiop:localhost:2809
The InitialContextFactory varies based on server instance you are using.
Question:
While configuring spring data source or JNDI we dont provide server details ( like name of server, type .. etc) and in which port corbaloc running.
If I really write my own program to get data-source then I have to know above details to get but
How Spring code is so generic and without knowing those details how it is getting JNDI reference?
thanks for your answers..

Need sample of registering a gzip/deflate filter in grizzly http server

I would like to see an example of registering a filter in grizzly http server for a specific url mapping (e.g. "/foo") that can handle gzip/deflate compressed payloads.
I am currently registering several HttpHandler instances to handle my different mappings, via something like this
server.getServerConfiguration().addHttpHandler(..., myContextPath)
Some of those mappings also need to support gzip/deflate compression. It is not clear to me how that could be done. Sample code or a pointer in the right direction would be appreciated.
Thanks in advance
Greg
Compression within Grizzly is based on response mime-types
You can enable compression on a per-HTTP-Network-Listener basis.
server.getListener("grizzly");
grizzly is the default listener name, you can access it using whatever name you've specified, or you can get all listeners via getListeners().
You can then call getCompressionConfig() on the listener instance which returns a CompressionConfig instance.

How to define Input and Output types to a proxy service in WSO2 ESB?

I am trying to create a proxy service which should take a string as an Input and response back a string ( String as an Output ) , In order to do so , I would define inputs and outputs in my XML Schema and I'd create a Proxy Service using the created XML Schema in Oracle Service Bus.
When it comes to WSO2 ESB , i dont find the functionality of using XML Schema methodology to define input and output for a proxy service
In WSO2 we have an option of defining the Input and Output to a proxy service in the form of WSDL ( Specifically an Abstract WSDL )
I tried to implement the same when creating the Proxy Service from WSo2 ESB console , but it is throwing an error like :- Proxy Service creation Error ; Unbale to find the Service running with the targetnamespace mentioned in the WSDL file .
Could you please help me on this
Following documentation explains about Proxy Services and how to create them.
http://docs.wso2.org/display/ESB480/Lesson+Three%3A+Mediating+Services
http://docs.wso2.org/display/ESB480/Working+with+Proxy+Services
Proxy services have an option called publishWSDL for which you can specify a WSDL which would be published as the WSDL of the proxy service and which can be accessed as
http://localhost:8280/services/NameOfProxy?wsdl
Not sure what you mean as 'defining input and output'. It would be helpful if you share your proxy service config and the exact error you get.

WSO2 ESB JMS listener configuration at runtime

I am trying to add new parameter from WSO2 admin console Transport Management -> JMS Listener screen (don't want to use axis2.xml as I want updates to be used by proxy services without re-starting servers - hope this is possible ?). While adding new parameter I am getting following error -
Error while initializing JMS listener
java.lang.String cannot be cast to org.apache.axiom.om.OMElement
Can you please advise what should be the format of parameter value. I am trying to add similar value as available under "default" or "myQueueConnectionFactory".
I tested your scenario and this seems to be a bug with ESB. Go to JMS Listener Configuration and click on Update without any change to the default parameter values. Even then the same error is thrown. So I have reported this issue at https://wso2.org/jira/browse/ESBJAVA-2412.
Unfortunately for now you will have to configure the parameters through axis2.xml until this issue is fixed. You can enable/disable the listeners through management console without any issue.

Resources