Embed Spring data flow server and skipper server with my existing spring boot based micro service - spring-cloud-dataflow

I am new to SCDF. I would like to embed SCDF server and skipper server to a single existing micro services rather than having dedicate executable jars.
Is it possible and do we have sample example?

Technically you can run Dataflow embedded in another app but you can not run both Dataflow and Skipper together in the same app.
⚠️ Disclaimer: This mode is not recommended nor officially supported. However, I will share how to theoretically embed the Dataflow server in an existing app.
Add the SCDF sever starter dependency. In maven it would be the following:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-dataflow-server</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
I added H2 in order to avoid dealing w/ the database. You will also need to be sure you have a schema available (something the install normally handles for you).
Add the #EnabledDataFlowServer to your SBA (note the auto-config exclusions - taken from here).
At this point the app should start successfully.
If you continue the exercise and attempt to add Skipper server, you will see how it breaks.
Add in the Skipper server starter dependency:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-skipper-server</artifactId>
<version>2.8.2</version>
</dependency>
Add the #EnableSkipperServer to your SBA.
On startup you will see the bean name clashes. If you attempt to allow bean overriding you will see the next wave of bean mismatches. As pointed out above, the overall system is not architected to run this way.
Summary: You can run Dataflow embedded in another app but you can not run both Dataflow and Skipper together in the same app.

Related

Deploy resource adapter and application in websphere liberty image

I have a requirement to create a spring boot application and connect it to EIS via dtpraUnisys JCA adapter. the flow is
Application -> ADapter RAR -> EIS
I want to use the websphere liberty image and then bundle the rar and the application jar file
Where should I give the rar file location, application jar file details.
is there any example which I can refer based on docker image
I don't know of anything official, but I did go through something similar (but with Java EE instead of Spring Boot) with IBM MQ on my Github.
The basic idea is that you typically place resource adapters and other shared in /opt/ol/wlp/usr/shared/resources/ for Open Liberty or /opt/ibm/wlp/usr/shared/resources for WebSphere Liberty. I do that in my Dockerfile:
RUN mkdir /opt/ol/wlp/usr/shared/resources/wmq/ && chown -R 1001:0 /opt/ol/wlp/usr/shared/resources/wmq/
COPY --chown=1001:0 docker/wmq.jmsra.rar /opt/ol/wlp/usr/shared/resources/wmq/
Then you reference them in server.xml, using the shared.resource.dir variable:
<resourceAdapter id="mqJmsRa" location="${shared.resource.dir}/wmq/wmq.jmsra.rar">
<classloader apiTypeVisibility="spec, ibm-api, api, third-party"/>
</resourceAdapter>
From there, you might have to create some config items. I'm not sure what EIS needs, but the entire server.xml syntax is documented on the Open Liberty website (this applies to WebSphere Liberty, too) so you can find what you need. You'll usually need to reference your resource adapter to set properties on it using the properties.<adaptorName> element.
This works for any type of application on Liberty. Deploying the spring boot app might require some extra steps. There's a good guide to deploy a spring boot app on Liberty in Docker on the Open Liberty guides site.

Install Hoverfly in windows without Docker/Kubernetes

Looking at Hoverfly installation it describe how to install using Docker or Homebrew or Kubernetes
I don't use micro services and don't have/use Docker/Homebrew/Kubernetes
Can I still use Hoverfly or I have to install Docker/Kubernetes to execute it on windows/linux?
Actually it's just executable you can download it
And Get started by running hoverctl start
Or for test add as maven dependency
To use Hoverfly, we need to add a single Maven dependency:
<dependency>
<groupId>io.specto</groupId>
<artifactId>hoverfly-java</artifactId>
<version>0.8.1</version>
</dependency>

Neo4j Enterprise embedded database

I'm going to try Neo4j Enterprise embedded database. Right now I can't find any tutorials that explain how to configure and use Neo4j Enterprise embedded database togher with Maven and Spring.
In order to use embedded Neo4j Enterprise should I download Neo4j zip archive and start it or Maven dependency should be enough ? I don't understand collaboration between Java configuration and for example downloaded distributions.
Could you please tell me the proper way how to use Neo4j Enterprise embedded database together with my application ?
If you really need to embed Neo4j into an application, you most likely just need the core and kernel apis which is under the org.neo4j:neo4j dependency not the enterprise dependencies (org.neo4j:neo4j-enterprise).
Your maven config would have the following dependency:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>NEO4J VERSION HERE</version>
</dependency>
Your question makes me think that you may really want to just run Neo4j as a server and connect to it via REST or any of it's BOLT drivers. You don't download and start the embedded version - you do that with the server. Can you clarify exactly what you want to do?
Just add a neo4j dependency on org.neo4j:neo4j-enterprise:<version>
If you don't need HA that's all you need.

JMX Monitoring using jboss-cli

We have an application which used JBoss 4.2.3.GA and we are migrating it to WildFly 8.2. In the old implementation, the JMX monitoring was done using twiddle. Since twiddle doesn't exist in WildFly, we are using the JBoss CLI for JMX monitoring.
Is it the right approach to use the JBoss CLI for JMX monitoring? Are there any command line tools similar to twiddle which can be used for JMX monitoring in WildFly?
One option to get something similar would be to simply query the JMX MBeans programmatically yourself. The advantage here is that your solution can be reused without depending on things like Twiddle which may be discontinued and also are compatible with other app servers.
Here is an example using Groovy to query an MBean in Tomcat and here is an example using Java to query an MBean in ActiveMQ.
If you choose to go with Groovy, you should be aware that there is a way to use Groovy (or Javascript or Python) to wrap the CLI and have more of a control flow. The CLI is great for simple declarative things, but lacks the versatility of a proper scripting language.
If you want to use pure CLI, then that's fine too, but I would suggest you create files which you can then call through bash e.g.:
$JBOSS_HOME/bin/jboss-cli.sh -c --file="my-jvm-monitoring.cli"
You might find this CLI model reference useful and also this blog about monitoring WildFly with the CLI

Why to use JBoss for Grails deployment?

I'm working on the project that uses Grails as Web framework and JBoss for deploying web-applications. JBoss allows to configure connection to database and then Grails could use JNDI datasource. However in our project we don't use JNDI datasources, we configure data sources for both development and production in DataSource.groovy. Other JBoss services are not used also.
I understand that if we are using JNDI datasource connections then we may benefit if several grails applications are deployed, because in this case there is no need for each grails application to establish its own connection.
So I wonder is there any sense to use JBoss instead of, say, Tomcat or Jetty, if not using it's services?
JBoss is a J2EE container. Compared to Tomcat which is a Servlet and JSP container only, the JBoss AS has a lot more features. Thus JBoss is also "heavier" than Tomcat, and depending on the size of your project this may not fit well with your development team since it has a longer development cycle (I heard there were a lot of improvements in JBoss 7, haven't tried it yet though.)
If you are not using any of the J2EE container features (JMS, EJB, etc.) then you could be fine going with Tomcat using a grails application. We use Tomcat at work for hosting one of our web applications.
In regards to connection pooling managed by JBoss, Tomcat can also do that. Take a look at this documentation page. Hope this helps.

Resources