printbean.java
来自「java方面经典书原代码,是我收集到最好的代码.」· Java 代码 · 共 31 行
JAVA
31 行
package com.foshanshop.ejb3.impl;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
@MessageDriven(activationConfig =
{
@ActivationConfigProperty(propertyName="destinationType",
propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination",
propertyValue="queue/foshanshop")
})
public class PrintBean implements MessageListener {
public void onMessage(Message msg) {
try {
TextMessage tmsg = (TextMessage) msg;
this.print(tmsg.getText());
} catch (Exception e){
e.printStackTrace();
}
}
private void print(String content){
System.out.println(content);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?