【发布时间】:2015-03-23 18:55:53
【问题描述】:
您好,我已经在 activemq 中配置了 camel.xml 文件来发送邮件。这是xml配置代码
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties" location="classpath:properties"/>
<route>
<description>Event Detected</description>
<from uri="activemq:topic:Events?selector=JMSType='Event'"/>
<to uri="xslt:file:{{activemq.conf}}/XLSs/Event.xsl"/>
<to uri="smtp://mail.net:25?from=abc@abc.com&to=abc@abc.com&subject= Hello World!&contentType=text/html"/>
</route>
</camelContext>
</bean>
</beans>
这是我用来将 xml 转换为 html 以在邮件正文中发送的 Event.xslt。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/Event">
<html>
<head>
<title>Event Detected!</title>
</head>
<body>
<h2>
Event Detected!
</h2>
<xsl:value-of select="Title"/>
</body>
</html>
有没有办法可以动态地将邮件主题设置为邮件正文中的 Title 属性?
这也是我的xml
<?xml version="1.0" encoding="utf-8" ?>
<Event xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Title>Test</Title>
</Event>
【问题讨论】:
标签: xslt jms apache-camel activemq