Mule : how do I deploy multiple Mule projects together as one? - maven

I'd like to keep Mule Projects small for the sake of simplicity. This means that I'd only like a single Mule project to hold flows which are related.
However, when deploying I'd like to bundle all projects and deploy them together as one. Is there a good way to do this using Maven which will result in a single Mule deployable file which to Mule looks like a single project?

As far as I understand, your mule-deploy.properties file is the one responsible for holding the list of flows which should be executed or deployed.
It is generated automatically, when you first create a project. It automatically gets populated as flows are added.
It is located at src->main->app.
Try to deploy the project on mule-standalone and it will deploy all the flows as one.

Related

OpenAPI multimodule EAR deployment

I would like to package 2 openapi.yaml definition files with it's corresponding implementation, each one in it's own war file into one ear and deploy it to openliberty. So war this works and when openliberty start up it shows me the url for ~/openapi/ui and the corresponding REST-Services ~/converter1 and ~/converter2. When I use openapi/ui I only can see one Service definition, the second one I can not see. Do I something wrong? Should my scenario work with openliberty?
My general UseCase is to have severel REST-Services defined by OpenApi's grouped together as long as they are in a common domain. Until now I can run each openapi.yaml on its own OpenLiberty but I like to group my REST-Services together into one OpenLiberty Server.
Does somebody knows a solution to my problem?
As you have noted, Open Liberty's MicroProfile OpenAPI support (via the mpOpenAPI-1.0 feature) only supports a single application per server.
If you want to aggregate multiple OpenAPI documents in a single server you have to use WebSphere Liberty's openapi-3.1 feature. See these docs for more info.

How to create a new microservice spring?

I'm using Intellij IDE Ultimate and I create a Project with spring inicializer. The problem is... now I need create more microservices (Spring Boot) but idk how to do this in IDE. I the end I need 3 microservices. Have a terminal command to create a new microservice inside my project? Or a way in the IDE to do this.
What you need to do is creating several modules (normally Maven modules), each of them is a SpringBoot application with its own application context and its own configuration, directories structure, etc.
IntelliJ has a concept of Module which matches very well the Maven module concept.
If you go to File, Project Structure, Project Settings, Modules you can see a very nice view of the current modules (in your case it should be only one). You can add or remove modules there. (Also by just clicking File-New Module, but the Project Structure View is more useful).
If you decide going the Maven way, you can also create your structure in disk and its POMs and import maven project in IntelliJ.
In any case, keep in mind that you will like to deploy every microservice as a separate and autonomous deployable unit.

Reusing Mule connectors and validation flows

How to reuse mule code (flows, exception strategies, database connectors, validators) across several projects. It's a application specific reusable artifacts, not an enterprise wide reuse.
For ex: I have some master code( validators, flows, and exception stratagies) which should be reused in a 15 different flows. (i.e 15 different mule projects). We are not using maven at the moment. One way I explored is, we could jar it and publish to local nexus repo, and re-use it via pom. Is there any other way ?
If possible, I also would like to make it dynamic, such that if I change the master code and deploy, it should be in effect without having to redeploy the ones that are using it.
You can reuse flows etc. (everything which is in Mule xml files) and Java classes by placing them in a plain Java project, building a jar from it and placing the jar on the classpaths of the importing Mule projects.
To use the stuff in the xml files, import them with .
Your question sounds like you already know this part.
I recommend building all Mule projects and the so called master project with Maven, Mule projects with packaging Mule, the master project with packaging jar.
Maven will pack the master part inside the using projects, so there is no dynamic update.
When you want this dynamic update, don't build with Maven or set the scope to "provided". In this case the master is not packaged in the other Mule projects. You have to make sure it is on the server classpath, e.g. in lib/user. Then you can change it there, restart the Mule server and all projects get the update.
Same with another level of indirection/possibility for grouping can be done with Mule domains.
All the dynamic stuff described so far does only for on premise Mule servers, not for CloudHub.

Separating client and server side deployments JavaEE & Website dev

I need to deploy 2 packages to Wildfly:
1. EAR file - containing all server side (JavaEE) code.
2. WAR file - containing website code (HTML,JS,CSS...).
In order for the website path to be something like localhost:8080/somename/index.html, I need to specify <finalName>somename</finalName> in Maven. On the other hand, the EAR file contains the RESTful stuff, and in order for the REST to be under the somename context root I added the appropriate tag to maven-ear-plugin.
Now... I guess Wildfly doesn't like 2 things to be registered under same name, so I can't deploy the website.
What is the proper way to approach this problem? Combine the two projects under the same name and deliver only one package?? maybe change the context root of the EAR since it's "the RESTful voodoo stuff" that is not really important?
I would really want to register the two under the same context root but leave both projects separated.
You can't register two different WAR's under the same context. Since you want to leave the business logic separate from the UI it's probably best to register the WAR with your REST services under a different context.

How to combine 3 standalone applications on java and run parallely with maven in spring

How to combine 3 standalone applications on java and run parallely with maven in spring.
The three othe standalone applications run on different Db's and I want to make use of these three in my main Standalone app.
What are the required maven settings i need to follow and what are the best spring components i used.
Any kind of answer is appresiable.
Thanks in Advance.
About Maven.
I recomend you to use a Repository Manager (Nexus, Artifactory...). In that repository, you can upload manually your aplications as a jar (I assumed that these three app are not build with Maven, but it could be interesant to migrate them, you should evaluate that).
You have to configure your new app pom.xml and settings.xml to get access to this repository. And then, you can add these dependencies in your new app pom.xml. After that, you can use your applications classes in your new app.
About Spring
Spring Framework, has a lot of things that could help you in your development (like dependency injection, jdbcTemplate and a large etc)
I really recommend you to read the documentation (with the index you can get an idea), and evaluate what things could help you.

Resources