`
kong6001
  • 浏览: 141256 次
  • 性别: Icon_minigender_1
  • 来自: 广东广州
社区版块
存档分类
最新评论

ActiveMQ Spring配置

阅读更多
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.org/config/1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
  http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
  
  <!--  lets create an embedded ActiveMQ Broker -->
  <amq:broker useJmx="false" persistent="false">
    <amq:transportConnectors>
      <amq:transportConnector uri="tcp://localhost:0" />
    </amq:transportConnectors>
  </amq:broker>

   <!--  ActiveMQ destinations to use  -->
  <amq:queue id="destination"  physicalName="org.apache.activemq.spring.Test.spring.embedded"/>

  <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
  <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
  

  <!-- Spring JMS Template -->
  <bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
      <!-- lets wrap in a pool to avoid creating a connection per send -->
      <bean class="org.springframework.jms.connection.SingleConnectionFactory">
        <property name="targetConnectionFactory">
          <ref local="jmsFactory" />
        </property>
      </bean>
    </property>
  </bean>

  <bean id="consumerJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsFactory"/>
  </bean>
</beans>
分享到:
评论
2 楼 jlcon 2009-05-08  
你这不就是抄的
http://activemq.apache.org/spring-support.html
么?
<amq:transportConnector uri="tcp://localhost:0" />

<amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/> 
为什么要配两个地址?
1 楼 tzb2008 2008-09-15  
amq:broker  amq:queue amq:connectionFactory 大哥问下在我得配置文件中,上面这几个标签怎么找不到啊?

相关推荐

    activeMQ_spring简单案例(含XML配置)

    接下来,我们看看如何在Spring中配置ActiveMQ。Spring框架提供了一套完整的JMS支持,包括连接工厂、目的地(队列或主题)以及消息监听器的声明式配置。在XML配置文件中,我们可以定义如下的元素: ```xml ...

    activemq spring 客户端配置

    当一个服务器不可用时,Spring配置的连接工厂会自动尝试连接到Zookeeper中标识的其他复制节点。 以上就是关于“activemq spring 客户端配置”的主要内容。通过这些步骤,你可以构建一个能够在Spring环境中与...

    spring配置activemq详解

    在"spring配置activemq详解"这个主题中,我们将探讨如何在Spring项目中配置和使用ActiveMQ。以下是对这个主题的详细说明: 1. **配置ActiveMQ**: - 首先,我们需要在项目中引入ActiveMQ的相关依赖,这通常通过在`...

    ActiveMQ+spring配置方案详解

    当我们需要在Spring应用中集成ActiveMQ时,就需要进行相应的配置。本文将深入讲解ActiveMQ与Spring的整合配置方案。 首先,我们需要在项目中引入ActiveMQ的相关依赖。这通常通过在`pom.xml`文件中添加Maven依赖来...

    ActiveMQ路由配置方式

    ActiveMQ路由配置方式 ActiveMQ路由配置是Apache ActiveMQ项目中的一种重要配置方式,它依赖另一个Apache项目Camel。ActiveMQ集成了Camel,启动时同时会启动Camel。通过Camel Web Console可以进行Routing配置。 ...

    Spring集成ActiveMQ配置

    消息发送者通常不会在Spring配置文件中直接配置,而是利用Spring提供的JMS模板进行消息的发送。同样地,消息接收者也并非直接由Spring初始化,而是通过注入JMS模板来接收消息。 为了确保消息的正常接收,需要在应用...

    Spring-ActiveMQ.rar_Spring Activemq_activemq_activemq spring

    2. **Spring配置** 要在Spring应用中配置ActiveMQ,我们需要在Spring的配置文件(如:applicationContext.xml)中添加以下内容: - 引入JMS相关的命名空间:`&lt;beans xmlns="http://www.springframework.org/schema...

    activeMQ+spring

    3. **配置Spring**:在Spring的配置文件(如applicationContext.xml)中,我们需要配置JMS相关的bean,包括ConnectionFactory(连接工厂)、Destination(目的地,如Queue或Topic)、MessageListenerContainer(监听...

    spring activeMQ-demo 配置

    **二、Spring配置** 1. **JMS配置**: 在Spring的配置文件(如applicationContext.xml)中,添加对JMS的支持,包括定义ConnectionFactory、Destination(Topic或Queue)和MessageListenerContainer。 ```xml ...

    activeMq整合spring所需jar包

    3. 在Spring配置文件中声明JMS模板(JMSTemplate)和消息监听容器(MessageListenerContainer)。 4. 创建消息生产者,通过JMS模板发送消息。 5. 创建消息消费者,实现MessageListener接口,或者使用消息监听容器...

    activemq5.5.1 Spring模板

    3. 创建JmsTemplate:在Spring配置文件中,定义一个`JmsTemplate`bean,设置连接工厂和其他相关属性。连接工厂通常是通过`ActiveMQConnectionFactory`创建的。 4. 发送与接收消息:使用`JmsTemplate`的`...

    activeMQ_spring_Demo.zip_DEMO_activemq_activemq spring_rowbv3

    《ActiveMQ与Spring整合实战教程》 在Java企业级应用中,消息中间件扮演着至关重要的角色,它能够实现应用间的解耦,提高系统的可扩展性和可靠性。ActiveMQ作为Apache基金会的一个开源项目,是Java消息服务(JMS)...

    ActiveMQ与Spring整合示例Demo

    - `src/main/java/com/example/config/MessagingConfig.java`:Spring配置类,包含连接工厂、消息模板和监听容器的配置。 - `src/main/java/com/example/service/MessageService.java`:业务逻辑类,负责发送消息。 ...

    activeMQ+spring整合

    综上所述,"activeMQ+spring整合"是一个实用的示例,它演示了如何在Spring环境中配置和使用ActiveMQ,以实现消息的可靠传输。通过下载并研究`activemqDOME`这个压缩包中的代码,你可以更深入地理解这个整合过程,...

    activemq与spring整合源代码

    3. Spring配置:在Spring的配置文件中,定义JMS相关的bean,包括ConnectionFactory、Destination(队列或主题)、MessageListenerContainer等。这里可以使用`&lt;bean&gt;`标签和`&lt;jee:jndi-lookup&gt;`标签来引用ActiveMQ的...

    Spring和ActiveMQ整合的完整实例

    2. **配置Spring**:在Spring的配置文件中,定义JmsTemplate,指定ActiveMQ的ConnectionFactory,这通常是通过JNDI查找完成的。同时,可以配置MessageListenerContainer,它将负责监听消息并调用我们定义的消息监听...

    ActiveMQ与spring整合封装

    首先,ActiveMQ与Spring的整合主要基于Spring的JMS(Java Message Service)支持。Spring通过`ConnectionFactory`和`Destination`接口来抽象JMS提供者的具体实现,使得我们能够轻松地更换消息中间件,而无需修改大量...

Global site tag (gtag.js) - Google Analytics