how to share connector configurations between applications in mule esb? - mule

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}

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.

Handle multiple connector in one mule application using mule domain project

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.

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 manage database credentials for mule proejct

I am using database connector component, with vault component to store the database credentials. Now as per the documentation of both components i have created different properties file for each environment to store the encrypted credentials for diff env.
Following is the structure of my mule project
Now the problem with this structure is that i have to build new deployable zip file whenever i have to update the database credentials for any environment.
I need a solution where i can keep all credentials encrypted and centralized and i don't have to create a build every time after updated the credentials, We can afford to restart the server, but building new zip and deploying is really cumbersome.
Second problem we have this approach is a developer needs to know the production db to update it in properties file, this is also a security issue.
Please suggest alternate approach for credentials management for mule projects.
I'm going to recommend you do NOT try to change the secure solution provided to you by MuleSoft. To alleviate the need for packaging and deployment, you would have to extract the properties files outside of the deployment and this would be a huge risk. Regardless of where you store the property files within the deployment if you change the files, you have to package and re-deploy. I see the only solution to your problem as moving the files outside of the deployment and securely storing them. Mule has provided a solution while it may be cumbersome, they are securing these files first with encryption and secondly within the server container. You can move out the property files but you have to provide a custom implementation and you will be assuming great risk to your protected resources.
Set a VM arguement e.g. environment.type=local for local machine on your anypoint studio.
Read this variable in wherever you are reading your properties file in a way that environment type is read dynamically such as below.
" location="classpath:properties/sample-app-${environment.type}.properties" doc:name="Secure Property Placeholder"/>
In order to set the environment type on your production server(or wherever you are using mule runtime), open \conf\wrapper.conf and add the arguement wrapper.java.additional.=-Dserver.type=production. If you already have any property in this file, you may need to set the value of n appropriately. For example 13 or 14.
This way you don't need to generate different deployment artefacts for different environment because correct properties file is picked by using environment specific VM arguement.

Adding custom object to JNDI on Weblogic 10

Is it possible to add a custom object (String or URL) to JNDI using Weblogic Server Administration Console (Weblogic 10.0) or by editing server's configuration file (config.xml)?
I don't think so. Quoting Load objects in the JNDI tree:
Using the Administration Console, you can load WebLogic Server J2EE services and components, such as RMI, JMS, EJBs, and JDBC Data Sources, in the JNDI tree.
And indeed, I couldn't find a way to add a String or URL using the console.
AFAIK, the standard way is to put an env-entry in your deployment descriptor (web.xml, ejb-jar.xml):
<env-entry>
<env-entry-name>string/foo</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>foobar</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>url/bar</env-entry-name>
<env-entry-type>java.net.URL</env-entry-type>
<env-entry-value>http://foobar/</env-entry-value>
</env-entry>
I have reached this with exactly the same problem. In Websphere, for example, I can add arbitrary parameters such as temporary directories, passwords, and other information to JNDI without having to recompile/rebuild the EAR.
I've searched for a while and seems Weblogic lacks this feature. What I did was write a helper class that first searches JNDI for a given configuration key, and if it doesn't find it then falls back to searching environment or system variables.
Perhaps this could be enhanced to also search for those properties prefixed by the application's name or context root, discovered at runtime, to avoid name clashes when multiple instances of the same EAR are deployed.
You can but you will lose high availability if using cluster. See:http://docs.oracle.com/cd/E11035_01/wls100/jndi/jndi.html#wp475702