Handle multiple connector in one mule application using mule domain project - mule

I have an application which consist of two http connector with different host and port. How to handle it with shared resource i.e. mule domain project.

Have a look at https://docs.mulesoft.com/mule-user-guide/v/3.8/shared-resources.
The general idea is simple:
1. Create a domain project (in AnypointStudio: New -> Mule Domain project)
2. Move your connector configuration from the project to the domain project (use cut/paste in XML, not the graphical editor)
3. Reference the domain project from your Mule project (property domain in mule-deploy.properties
And don't forget for deployment: The domain must be deployed before you deploy your project.

#Kishan Kumar Soni, The referenced documentation explains on how use the Shared Resources with mule and is not meant for single connector only. You can move your two http:listener-config into shared resources config(domain-config) file, make sure to have unique name, then reference them in your application(s) as desired. It will work.

Related

WSO2 ESB HTTP Endpoint does not get added to the Synapse configuration

I have built an ESB Project with an HTTP endpoint. But for some reasons. The Endpoint that I have defined and added to the ESB Solution does not seem to be reflected in the project and seem to be not reflecting when I deploy to the server. The endpoint is basically not being used. I have also tried to check the under the Defined Endpoints tab in the server Enterprise Integrator console, #
Home > Manage > Service Bus > Endpoints
but it isn't there. Numerous restarts have not helped neither has undeploying and redeploying the car file. Can someone point out where I might have gone wrong? As usual, thanks in advance.
Could be different things, to check:
Extract the .car file (it's just a .zip, so rename or use 7zip to
extract) and see if your endpoint is there.
Check if the serverrole in the pom file is correct (should be EnterpriseIntegrator it think)
Sometimes renaming artifacts causes problems as the file does not get renamed correctly or a reference is not updated in one of the
project files. Try removing the endpoint and use 'search in files' to
remove any lingering references in pom files.

Mule ESB pluggability

I am new to Mule ESB. I want to know that, can I upgrade Mule application without redeploying. I am talking about pluggability. Suppose my application is already running and now some more features or client flow added. Now I want to add this new flow like a new plugin. Is it possible to do it without down time.?
For e.g. In my Mule application, I have used one HTTP connector to connect with one client.
Now in case of new HTTP connector required to add, can I do it without redeploy.?
You can now modify your configuration files and custom classes and have them reloaded without having to restart Mule.
Mule checks every three seconds for updated configuration files under the $MULE_HOME/apps directory, and when it finds one, it reloads the configuration file and the JARs in that applications lib directory.
https://docs.mulesoft.com/mule-user-guide/v/3.2/hot-deployment
You can "try" to update or replace an application folder contents and touch/modify the application’s configuration file to have Mule reload the config and automatically re-deploy the application.
No, you can't. What you can do is to deploy a new application, and use the same HTTP connector if you define it in a common domain for both applications.
This is not possible in a single server. You can achieve it through martinfowler.com/bliki/BlueGreenDeployment.html .
To make this work you need two servers and a proxy in front. You take one server offline in the proxy, update it then reenable. Then you do the same with the second server. we are facing same issue in Talend ESB.
It's not possible but you can add and redeploy the application

how to share connector configurations between applications in mule esb?

Instead of using mule domain project (supports only sharing of connector configurations of jms, http... limited connectors). I need to share connector configuration of Object store connector between applications. I am trying to access common data in multiple applications, hence I need this. please help me.
try with session Objects you can send session data between different mule application.
You could use configuration properties through a properties file in the domain project such as
domain.properties
Example properties:
domain.value1=true
domain.value2=my text
. This file would be under the
src/main/resource
folder in your domain project.
You can refer to this property file in your application as the global configuration element, property-placeholder. Example:
<context:property-placeholder location="..\..\domains\<domain project name>\domain.properties"/>
Simply refer to the property using
${domain.value1}

How to specify application / domain name in a deployable zip?

I am building a Mule domain using Maven which works fine, except the zip file it creates is named MyDomain-1.0.0.0.zip
Mule (community edition) will bring up this domain with a domain name of MyDomain-1.0.0.0 when deployed.
I want the name to be MyDomain. I cannot find a way of specifying the domain name which is used - it seems Mule always uses the zip file name.
The reason i want to do this is because the applications in the domain are coded to use MyDomain, and obviously fail if the domain isnt named as such.
When running in AnyPoint, the domain is named after the project name, and I dont want to have to change the project name in Anypoint to include the version number.
Is this possible please? the only way round it ive found is to rename the zip file to MyDomain.zip, which I dont want to do since I want releases to have unique zip filenames (but keep the same domain name)
You can use the finalName child tag of build i.e:
<build>
<finalName>myapp</finalName>
</build>
Use the domain including the version. It would allow you to have apps run in different versions of a domain without the requirement of a turn-key switch to a new domain version.
So, create a project called 'myDomain' (you probably have that) and set in the mule-project.xml of your domain that the domain is 'myDomain-1.0.0'. This would allow the versioning of both the domains and the api referencing them to be handled by maven versioning and not force any weird and ugly things like using finalName (which forfeits all SNAPSHOT and versioning capabilities).
Also, you are now free to develop a myDomain2 and let it propagate the 'myDomain-2.0.0' domain. The reference of every app to it's domain in the pom.xml will be just as it's suppose to be. An app will just request 'myDomain-1.0.0' from the .m2 maven repo and it will find it.

How to specify default glassfish-web.xml?

I have a situation where I need to specify some properties in glassfish-web.xml (like
session-properties & cookie-properties) that needs to be applied to all web application that are deployed under that domain.
One option is to create glassfish-web.xml per web-application. This is fine if there are only a few web applications on a domain.
However as these properties are common across all web applications I am wondering if there is a way to specify these configuration at glassfish server domain level (like default-web.xml) that are applied to every web application deployed.
If you are using Glassfish 3+, put the configurations desired in [GF_HOME]/domains/[yourdomain]/config/default-web.xml
Take a look at: https://docs.oracle.com/cd/E19798-01/821-1752/beagc/index.html