- 浏览: 62287 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (93)
- java (3)
- ios (9)
- wp (15)
- android (0)
- js (1)
- 服务器 (0)
- db (0)
- linux (1)
- python (0)
- xcode (0)
- ide (2)
- maven (0)
- spring (0)
- sql (0)
- 第三方 (1)
- nexus (0)
- nginx (11)
- tomcat (0)
- jenkins (0)
- zookeeper (1)
- git (1)
- svn (0)
- uml (0)
- redis (4)
- activemq (1)
- flume (0)
- kafka (0)
- mysql (1)
- memcached (0)
- mybatis (0)
- mac (0)
- mongo (1)
- docker (6)
- cache (0)
- jvm (0)
- markdown (0)
- springboot (24)
- mycat (3)
- LTS (3)
- 运维 (0)
- opts (1)
- netty (1)
- tcc (0)
- ffmpeg (2)
- 直播 (6)
- cxf (0)
- nodejs (0)
- storm (0)
- elasticjob (0)
- php (0)
最新评论
pom.xml
=======================================================
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
=======================================================
AmqConfigation.java
=======================================================
@Configuration
public class AmqConfigation {
@Bean(name= "connectionFactory")
public ActiveMQConnectionFactory connectionFactory () {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL("tcp://172.16.30.57:61616");
factory.setUseAsyncSend(true);
factory.setUseCompression(true);
factory.setMaxThreadPoolSize(100);
return factory;
}
@Bean(name = "simpleMessageConverter")
public SimpleMessageConverter getSimpleMessageConverter(){
SimpleMessageConverter converter = new SimpleMessageConverter();
return converter;
}
@Bean(name = "queue1")
public ActiveMQQueue queue(){
return new ActiveMQQueue("queue1");
}
}
=======================================================
AmqConsumerConfiguration.java
=======================================================
@Configuration
public class AmqConsumerConfiguration {
// public RedeliveryPolicyMap getRedeliveryPolicyMap(){
// RedeliveryPolicyMap policyMap = new RedeliveryPolicyMap();
// RedeliveryPolicy policy = new RedeliveryPolicy();
// policy.set
// policyMap.setDefaultEntry();
// }
//=================================one start
@Bean(name = "messageConsumer1")
public IMessageConsumer getMessageConsumer1(){
IMessageConsumer cunsumer = new MessageConsumer1();
return cunsumer;
}
@Bean(name = "messageListenerAdapter1")
public MessageListenerAdapter getMessageListenerAdapter1(@Qualifier("messageConsumer1")IMessageConsumer consumer,
@Qualifier("simpleMessageConverter") SimpleMessageConverter converter){
MessageListenerAdapter listenerAdapter = new MessageListenerAdapter(consumer);
listenerAdapter.setMessageConverter(converter);
listenerAdapter.setDefaultListenerMethod("handleMessage");
return listenerAdapter;
}
@Bean(name = "messageListenerContainer1")
public SimpleMessageListenerContainer getSimpleMessageListenerContainer1(@Qualifier("connectionFactory") ActiveMQConnectionFactory connectionFactory,
@Qualifier("queue1") ActiveMQQueue queue,
@Qualifier("messageListenerAdapter1") MessageListenerAdapter listenerAdapter){
SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
listenerContainer.setConnectionFactory(connectionFactory);
listenerContainer.setDestination(queue);
listenerContainer.setMessageListener(listenerAdapter);
listenerContainer.setConcurrency("5-10");
listenerContainer.setSessionTransacted(true);
return listenerContainer;
}
//=================================one end
}
=======================================================
AmqProducterConfiguration.java
=======================================================
@Configuration
public class AmqProducterConfiguration{
@Bean(name = "messageProducter1")
public JmsTemplate getTemplate(@Qualifier("connectionFactory") ActiveMQConnectionFactory connectionFactory,
@Qualifier("simpleMessageConverter") SimpleMessageConverter converter,
@Qualifier("queue1") ActiveMQQueue queue ){
JmsTemplate template = new JmsTemplate();
template.setConnectionFactory(connectionFactory);
template.setMessageConverter(converter);
template.setDefaultDestination(queue);
template.setExplicitQosEnabled(true);
template.setDeliveryMode(2);
template.setPubSubDomain(false);
template.setSessionTransacted(true);
template.setSessionAcknowledgeMode(1);
return template;
}
}
=======================================================
IMessageConsumer.java
=======================================================
public interface IMessageConsumer {
void handleMessage(String message) throws JMSException;
}
=======================================================
MessageConsumer1.java
=======================================================
public class MessageConsumer1 implements IMessageConsumer {
public void handleMessage(String message)throws JMSException{
try{
System.out.println("message = [" + message + "]");
}catch (Exception e){
}
}
}
=======================================================
MessageProducter.java
=======================================================
public interface MessageProducter<T extends BaseEntity> {
void send(T t);
}
=======================================================
MessageProducter1.java
=======================================================
@Component("test-messageSender1")
public class MessageProducter1 implements MessageProducter<City> {
@Resource(name = "messageProducter1")
JmsTemplate messageSender;
@Override
public void send(City data) {
try {
messageSender.convertAndSend("");
}catch (Exception e){
}
}
}
=======================================================
test.java
=======================================================
@Resource(name = "test-messageSender1")
MessageProducter messageProducter;
public void send() {
City city = new City();
city.setCityName("测试");
messageProducter.send(city);
}
=======================================================
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
=======================================================
AmqConfigation.java
=======================================================
@Configuration
public class AmqConfigation {
@Bean(name= "connectionFactory")
public ActiveMQConnectionFactory connectionFactory () {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL("tcp://172.16.30.57:61616");
factory.setUseAsyncSend(true);
factory.setUseCompression(true);
factory.setMaxThreadPoolSize(100);
return factory;
}
@Bean(name = "simpleMessageConverter")
public SimpleMessageConverter getSimpleMessageConverter(){
SimpleMessageConverter converter = new SimpleMessageConverter();
return converter;
}
@Bean(name = "queue1")
public ActiveMQQueue queue(){
return new ActiveMQQueue("queue1");
}
}
=======================================================
AmqConsumerConfiguration.java
=======================================================
@Configuration
public class AmqConsumerConfiguration {
// public RedeliveryPolicyMap getRedeliveryPolicyMap(){
// RedeliveryPolicyMap policyMap = new RedeliveryPolicyMap();
// RedeliveryPolicy policy = new RedeliveryPolicy();
// policy.set
// policyMap.setDefaultEntry();
// }
//=================================one start
@Bean(name = "messageConsumer1")
public IMessageConsumer getMessageConsumer1(){
IMessageConsumer cunsumer = new MessageConsumer1();
return cunsumer;
}
@Bean(name = "messageListenerAdapter1")
public MessageListenerAdapter getMessageListenerAdapter1(@Qualifier("messageConsumer1")IMessageConsumer consumer,
@Qualifier("simpleMessageConverter") SimpleMessageConverter converter){
MessageListenerAdapter listenerAdapter = new MessageListenerAdapter(consumer);
listenerAdapter.setMessageConverter(converter);
listenerAdapter.setDefaultListenerMethod("handleMessage");
return listenerAdapter;
}
@Bean(name = "messageListenerContainer1")
public SimpleMessageListenerContainer getSimpleMessageListenerContainer1(@Qualifier("connectionFactory") ActiveMQConnectionFactory connectionFactory,
@Qualifier("queue1") ActiveMQQueue queue,
@Qualifier("messageListenerAdapter1") MessageListenerAdapter listenerAdapter){
SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
listenerContainer.setConnectionFactory(connectionFactory);
listenerContainer.setDestination(queue);
listenerContainer.setMessageListener(listenerAdapter);
listenerContainer.setConcurrency("5-10");
listenerContainer.setSessionTransacted(true);
return listenerContainer;
}
//=================================one end
}
=======================================================
AmqProducterConfiguration.java
=======================================================
@Configuration
public class AmqProducterConfiguration{
@Bean(name = "messageProducter1")
public JmsTemplate getTemplate(@Qualifier("connectionFactory") ActiveMQConnectionFactory connectionFactory,
@Qualifier("simpleMessageConverter") SimpleMessageConverter converter,
@Qualifier("queue1") ActiveMQQueue queue ){
JmsTemplate template = new JmsTemplate();
template.setConnectionFactory(connectionFactory);
template.setMessageConverter(converter);
template.setDefaultDestination(queue);
template.setExplicitQosEnabled(true);
template.setDeliveryMode(2);
template.setPubSubDomain(false);
template.setSessionTransacted(true);
template.setSessionAcknowledgeMode(1);
return template;
}
}
=======================================================
IMessageConsumer.java
=======================================================
public interface IMessageConsumer {
void handleMessage(String message) throws JMSException;
}
=======================================================
MessageConsumer1.java
=======================================================
public class MessageConsumer1 implements IMessageConsumer {
public void handleMessage(String message)throws JMSException{
try{
System.out.println("message = [" + message + "]");
}catch (Exception e){
}
}
}
=======================================================
MessageProducter.java
=======================================================
public interface MessageProducter<T extends BaseEntity> {
void send(T t);
}
=======================================================
MessageProducter1.java
=======================================================
@Component("test-messageSender1")
public class MessageProducter1 implements MessageProducter<City> {
@Resource(name = "messageProducter1")
JmsTemplate messageSender;
@Override
public void send(City data) {
try {
messageSender.convertAndSend("");
}catch (Exception e){
}
}
}
=======================================================
test.java
=======================================================
@Resource(name = "test-messageSender1")
MessageProducter messageProducter;
public void send() {
City city = new City();
city.setCityName("测试");
messageProducter.send(city);
}
发表评论
-
springboot:condition
2017-07-26 11:10 377public class LinuxCondition imp ... -
springboot:tomcat启动
2017-07-20 15:02 9381.在pom.xml里设置 <packaging> ... -
springboot:shiro
2017-07-13 15:52 982第一次学习系统学习shiro 并将shiro集成到sprin ... -
springboot:upload
2017-07-06 10:25 773FileUploadConfiguration.java == ... -
springboot:servlet
2017-07-06 10:17 523Application.java ============== ... -
springboot:freemarker
2017-07-05 17:33 607pom.xml ======================= ... -
springboot:task
2017-07-05 12:11 465TaskPool.java ================= ... -
springboot:热部署
2017-07-05 11:23 383pom.xml: ====================== ... -
springboot:注解
2017-07-04 11:36 648@EnableAutoConfiguration注解 excl ... -
springboot:server属性配置
2017-07-04 10:05 805server配置 ====================== ... -
springboot:memcached
2017-07-03 17:23 987pom.xml ======================= ... -
springboot:health
2017-07-03 16:43 428<dependency> ... -
springboot:mongodb
2017-07-03 15:38 1591pom.xml ======================= ... -
springboot:quartz集群
2017-07-02 20:40 1023pom.xml ======================= ... -
springboot:ControllerAdvice
2017-07-02 14:09 389全局异常拦截 //@ControllerAdvice(anno ... -
springboot:dubbo
2017-07-02 10:40 519server: ======================= ... -
springboot:redis(jedis)
2017-07-01 14:10 927application.properties ======== ... -
springboot:mybatis&druid&pagehelper
2017-07-01 13:35 432=============================== ... -
springboot:logback
2017-06-30 16:20 604=============================== ... -
springboot:interceptor
2017-06-30 14:04 663IncpConfig.java 增加拦截器config 继承W ...
相关推荐
在"springboot+amq+javamail+maven"的项目中,这些技术是如何整合的呢? 1. **SpringBoot与ActiveMQ集成**:SpringBoot可以通过添加对应的依赖来集成ActiveMQ。在配置文件中,我们可以设置ActiveMQ服务器的相关参数...
Red Hat JBoss A-MQ xPaaS产品应该已经安装并在OpenShift安装上运行,一种运行A-MQ服务的简单方法是遵循与amq63-basic模板相关的OpenShift的A-MQ xPaaS映像的文档。 。 然后,以下命令将打包您的应用并在OpenShift...
Spring-Boot,Camel和EnMasse快速入门本快速入门演示了如何使用Kubernetes或OpenShift将Spring-Boot应用程序连接到EnMasse(MaaS)并在两条骆驼路线之间使用JMS消息传递。 在此示例中,我们将使用两个容器,一个容器...
- **Amq_Producer_mt.cpp**:扩展了 Amq_Producer.cpp,增加了多线程支持,每个线程独立发送消息,提高消息发送速率。 - **Amq_Consumer.cpp**:消费者客户端的实现,负责接收和处理来自 ActiveMQ 服务器的消息。 ...
SpringBoot AMQ侦听器生产者应用程序 允许快速访问AMQ消息服务器的示例应用程序 用法 mvn clean install mvn spring-boot:run or java -jar target/spectrum-rest-activemq-poc-1.0.jar 这将创建一个功能全面的应用...
先决条件 必须安装docker 。 如果您使用的是 Mac OS X,请运行: boot2docker stop VBoxManage modifyvm ...docker build -t amq:5.10.0 . 运行代理 docker run --name amq1 -p=61613:61613 -p=61616:61616 -d -t
# 设置JMS(AMQ) spring.activemq.broker-url=tcp://localhost:61616 spring.activemq.user=admin spring.activemq.password=admin spring.activemq.pool.enabled=true # spring.jms.pub-sub-domain=true # 如果...
motan:支持motan rpc框架myth-springcloud:支持Spring Cloud RPC框架myth-spring-boot-starter:支持spring boot启动器myth-aliyunmq:对aliyunmq的支持myth-jms:支持JMS协议的Mq(amq ...) 神话卡夫卡:支持...
该系统采用Spring Boot 2.7、MyBatis、Redis、AMQ、Shiro和MySQL等主流技术,前端界面基于Element UI,设备端通过安卓播放APP及看门狗实现。系统能够进行广告素材管理、节目制作与发布、设备管理等功能。开源版本可...