ule子-使Global Elements更全球化 [英] Mule - make Global Elements more global

查看:99
本文介绍了ule子-使Global Elements更全球化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在m子中,我有许多应用程序在同一个容器上运行,这些应用程序使用相同的连接字符串/用户/密码集访问jdbc连接器.

In mule I have many applications running on the same container that access a jdbc connector with the same connection string/user/password set.

当然,任何应用程序都已在其xml配置文件中配置了相同的全局连接器,因此存在代码重复.

Of course any app has configured the same global connector in its xml configuration file, so there is code duplication.

是否有一种方法只能为每个容器定义一次连接并可以从任何应用程序访问它?

Is there a way to define only once per container the connection and access it from any app?

推荐答案

我会尝试这样做:让一个应用程序创建数据源并将其存储在JNDI中,让其他应用程序从JNDI中拾取它.

I would try this: have one app create the datasource and store it in JNDI and have the other apps pick it up from JNDI.

由于不能完全保证应用程序开始排序,因此可能需要一个需要JNDI数据源的应用程序启动得太早.您需要将Spring配置为能够在发生故障的情况下再次执行JNDI查找,并在Mule JDBC连接器上配置线程重试策略.

Since there is no strong guarantee of app start ordering, it's possible that one app that needs the JNDI datasource would start too soon. You would need to configure Spring to be able to perform the JNDI lookup again in case of failure and configure a threaded retry policy on the Mule JDBC connector.

此外,您还需要在lib/user中安装数据源和数据库JAR,以便所有应用程序都可以使用它们.

Also you will need to install the datasource and database JARs in lib/user so all apps could use them.

这篇关于ule子-使Global Elements更全球化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆