testmain.java

来自「jms程序,这是一个jms小程序给大家简单」· Java 代码 · 共 23 行

JAVA
23
字号
package com.andyao.activemq;

import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestMain {
	public static void main(String[] args) {
		ListableBeanFactory lsb = new ClassPathXmlApplicationContext("classpath:com/andyao/activemq/applicationContext-activemq.xml");
		GenericBeanFactoryAccessor gba = new GenericBeanFactoryAccessor(lsb);
		TopicMessageProducer fmpa = gba.getBean("topicMessageProducer");
		QueueMessageProducer fmpb = gba.getBean("queueMessageProducer");
		int count = 1;
		while (true) {
			FooMessage fm = new FooMessage();
			fm.setId(count);
			fmpa.send(fm);
			fmpb.send(fm);
			count ++;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?