spring-cloud - Hystrix Stream with just Ribbon - spring-cloud-netflix

With spring-boot-starter-actuator in a web application, where Ribbon/Feign Clients are used, hystrix stream/ endpoint is not enabled.
HystrixCircuitBreakerConfiguration.HystrixWebConfiguration is not activated even with the conditions being true.
How to enable hystrix stream for Feign/Ribbon?
Environment: Spring Boot 1.3.5.RELEASE, Spring Cloud Brixton.SR4

Did you add the #EnableHystrix to the context configuration?

Related

Embedding Camunda into an existing Java application

I have pulled the Camunda latest image and running Camunda in it's own docker container. I have a dmn uploaded to Camunda Cockpit and I am able to make Rest calls to get data from the decision table that I have uploaded to the Camunda Cockpit.
However, I do not want to depend on Camunda running independently. I have an existing huge application(a micro-service running in it's own docker container) and I want to embed Camunda into my micro-service (that uses Osgi, Java, Docker, Maven, etc.).
Can someone please guide me with this?
For a Spring Boot micro service you can add the required starter and config files to your deployment and should be good to go. See e.g. https://start.camunda.com/ to get everything you need.
You can then access Camunda via Java API or REST (if starter was included).
If you do not run in a Spring Boot environment then the way of bootstrapping Camunda may differ. In plain Java, without any container usage it would be along those lines:
ProcessEngine processEngine = ProcessEngineConfiguration
.createStandaloneProcessEngineConfiguration()
.setJdbcUrl("jdbc:h2:./camunda-db/process-engine;DB_CLOSE_DELAY=1000")
.setDatabaseSchemaUpdate("true")
.setJobExecutorActivate(true)
.buildProcessEngine();
processEngine.getRepositoryService()
.createDeployment()
.addClasspathResource("myProcess.bpmn")
.deploy();
ProcessInstance pi = processEngine.getRuntimeService()
.startProcessInstanceByKey("myProcess");
In a standard Spring environment you would bootstrap the engine by loading the context:
ClassPathXmlApplicationContext applicationContext =
new ClassPathXmlApplicationContext("/spring-context.xml");
ProcessEngine processEngine = (ProcessEngine) applicationContext.getBean("processEngine");
processEngine.getRepositoryService()
.createDeployment()
.addClasspathResource("myProcess.bpmn")
.deploy();
Also see:
https://docs.camunda.org/manual/latest/user-guide/process-engine/process-engine-bootstrapping/
https://docs.camunda.org/get-started/quick-start/install/
Update based on comment:
The Camunda OSGI support is described here:
https://github.com/camunda/camunda-bpm-platform-osgi
You would need to upgrade the project to a more recent version, which is likely not a huge effort as the version have remained compatible.
(I would also encourage you to consider migrating the micro service to Spring Boot instead. Complexity, available knowledge in the market, support lifetime,..)

Jolokia endpoint is not exposed through spring boot actuator in open shift

I have a camel application which is running in spring boot 2 and camel routes are visualized through hawtio. And all actuator endpoints are exposed including jolokia endpoint
this application is completely working in local and
when I try to access actuator endpoints in local http://localhost:8080/actuator/, i could see below endpoint along with other 16 endpoints (such as health, info and so on)
"jolokia": {
"href": "http://localhost:8080/actuator/jolokia",
"templated": false
}
I have deployed the in same Openshift, but when i try to access actuator endpoints in Openshift
i could see only 16 endpoints without jolokia endpoint
Application start up logs in local
INFO : Initializing Spring embedded WebApplicationContext
INFO : Root WebApplicationContext: initialization completed in 3543 ms
INFO : Registered '/actuator/jolokia' to jolokia-actuator-endpoint
INFO : Initialising hawtio services
INFO : Configuration will be discovered via system properties
INFO : Welcome to Hawtio 2.10.0
INFO : Starting hawtio authentication filter, JAAS authentication disabled
INFO : Initializing ExecutorService 'applicationTaskExecutor'
INFO : Detected and using LURCacheFactory: camel-caffeine-lrucache
INFO : Exposing 17 endpoint(s) beneath base path '/actuator'
Application start up logs in Openshift
INFO : Initializing Spring embedded WebApplicationContext
INFO : Root WebApplicationContext: initialization completed in 3543 ms
INFO : Initialising hawtio services
INFO : Configuration will be discovered via system properties
INFO : Welcome to Hawtio 2.10.0
INFO : Starting hawtio authentication filter, JAAS authentication disabled
INFO : Initializing ExecutorService 'applicationTaskExecutor'
INFO : Detected and using LURCacheFactory: camel-caffeine-lrucache
INFO : Exposing 16 endpoint(s) beneath base path '/actuator'
INFO : Registered '/actuator/jolokia' to jolokia-actuator-endpoint is missing in Openshift logs,
so clearly its not registered with spring boot actuator
Any idea why jolokia is not exposed via spring boot actuator ?
because of this hawtio is not able to access camel routes (JMX).
Issue is resolved
Solution : Disable the default OpenJDK8 jolokia in Openshift
In Local
Application is not running in Openshift / Docker as an image, running as normal spring boot application in tomcat so I didn't face this issue.
In Openshift
Application is running in openshift / Docker as an image instance.
The image is created with base openJDK 8 which has default jolokia enabled
Red hat openshift reference
I have disabled it by overriding it with AB_JOLOKIA_OFF:true in openshift environment variables.
or either if you are using maven fabric8 plugin in pom for building image then you can override jolokia properties it in pom itself (i haven't try it but its possible as per documents).

Http requests to CEP

I installed the CEP ( Proton ) through the official documentation, https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/CEP_GE_-_IBM_Proactive_Technology_Online_Installation_and_Administration_Guide
After that, I watched this recommended video to learn more about CEP. https://edu.fiware.org/pluginfile.php/653/mod_resource/content/1/CEP-Tutorial.mp4
But I can't check engine instance state, because appears this error in response:Could not read instance state, message: Error activating jmx proxy:
It seems that JMX is not properly configured.
As described in the installation guide, in the Apache Tomcat users configuration file you need to add manager-jmx role, and add it to the manager user name:
<tomcat-users>
...
<role rolename="manager-jmx" />
<user username="manager" password="manager" roles="manager-gui,manager-status,manager-script,manager-jmx" />
...
</tomcat-users>
You need to enable JMX access on Apache Tomcat, by adding it to CATALINA_OPTS, as described in the installation guide.
You also need to specify the JMX service port in the ProtonAdmin.properties file, as described in the same installation guide.

Stream Management (XEP-0198) in Prosody

I am using Prosody for stream management. But I am suffering from some issues.
How can I ensure that stream management is enabled on prosody ? Is there any command to test on terminal ?
I also tried to add mod_smacks.lua modules in modules. but I don't know how to enable it on server.
I am using XMPPFramework as chat client on iOS. There is already a method to check support for stream management or not, but it is returning me always false so far.
Please help me out to enable stream management in prosody.
After you added mod_smacks.lua into your /usr/lib/prosody/modules/ add
"smacks";
to your
modules_enabled = {
...
}
in your /etc/prosody/prosody.cfg.lua if you want the module to be loaded every time prosody starts.
Then restart prosody.
Prosodyctl does not show loaded modules.
You can check if the module is loaded via ad-hoc commands (or telnet if activated). You can even load and unload modules via ad-hoc/telnet.
You get more information about mod_smacks here.

Message Driven bean external configuration for JBoss with IBM MQ

I am working on a Notification Service using IBM MQ messaging provider with JBoss eap 6.1 environment. I am successfully able to send messages via MQ JCA provider rar i.e. wmq.jmsra.rar file. However on consumer part my current configuration looks like this
#MessageDriven(
activationConfig = {
#ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
#ActivationConfigProperty(propertyName="destination", propertyValue="F2.QUEUE"),
#ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="java:jboss/jms/TopicFactory"),
#ActivationConfigProperty(propertyName="queueManager", propertyValue="TOPIC.MANAGER"),
#ActivationConfigProperty(propertyName="hostName", propertyValue="10.239.217.242"),
#ActivationConfigProperty(propertyName="userName", propertyValue="root"),
#ActivationConfigProperty(propertyName = "channel", propertyValue = "TOPIC.CHANNEL"),
#ActivationConfigProperty(propertyName = "port", propertyValue = "1422")
})
My problem is that consumer of this service does not want to add any port numbers, hostName, queueManager properties in these beans. Also they do not want to use ejb-jar.xml to externalize these configs. I have researched and found that we can add a domain IBM Message Driven Bean but with no success. Any suggestions on what I can do here to externalize all these configurations ?
EDIT: Adding --> The JCA resource adapter is deployed at consumer end if it makes it any easier.
Thanks
You can actually externalize an MDBs activation spec properties to the server configuration file.
Create the ejb-jar.xml file, but do not put the actual value in the file, use a property placeholder:
<activation-config-property>
<activation-config-property-name>hostName</activation-config-property-name>
<activation-config-property-value>${wmq.host}</activation-config-property-value>
</activation-config-property>
Do this for all of the desired properties.
Ensure that property replacement for Java EE spec files (ejb-jar.xml, in this case) is enabled in the server configuration file:
<subsystem xmlns="urn:jboss:domain:ee:1.2">
<spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
Then, in the server configuration file, provide values for your properties:
<system-properties>
<property name="wmq.host" value="10.0.0.150"/>
Once your MDBs are packaged, you will not need to change any of the files in the MDB jar - just provide the properties in the server configuration.
you can avoid to add host name, port number and so on in MDB, you just want to define destinationType in MDB, and rest of the thing u can configure in your application server, like Activation Specification, Queues and Queue Connection Factories.
I have done the same thing but i used IBM Websphere Application Server.