我可以通过编程方式访问(和更改)smtp-connector的属性吗?

时间:2014-02-17 14:46:50

标签: java mule mule-el

我正在运行骡子3.3.1 CE。

我有一个用例,我需要能够在smtp端点上动态设置mime类型。但似乎我无法这样做,因为它目前被窃听: https://www.mulesoft.org/jira/browse/MULE-6005

另外,如果我使用MEL尝试设置像这样的mime类型:

mimeType="#[message.payload['email-mime']]"

我得到的只是堆栈堆栈,应用程序甚至不会部署。

  

错误2014-02-17 16:28:58,153 [Mule.app.deployer.monitor.1.thread.1]   org.mule.module.launcher.application.DefaultMuleApplication:null   org.springframework.beans.PropertyBatchUpdateException;嵌套   PropertyAccessException详细信息(1)是:PropertyAccessException 1:   org.springframework.beans.MethodInvocationException:Property   'mimeType'抛出异常;嵌套异常是   java.lang.IllegalArgumentException:无法找到子类型。           在org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1167)           在org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:924)

有没有办法在运行时访问连接器本身,也许能够更改它,以便我可以根据需要更改mime类型?或者另一种解决方案?

1 个答案:

答案 0 :(得分:1)

在Jira描述中定义一个单独的smtp:connector,并尝试在流中的某个位置的Groovy脚本中设置内容类型,如下所示:

muleContext.getRegistry().lookupObject('smtpConnector').setContentType('text/html')