- 浏览: 2551744 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
JBOSS5.1 Configuration and Run(二)ObjectMessageBean
1. The message Bean trans from the point to point, AddressMessage.java:
package com.sillycat.mdb.entities;
import java.io.Serializable;
public class AddressMessage implements Serializable {
private static final long serialVersionUID = 3887312094158862657L;
private Integer id;
private String street;
private String country;
public AddressMessage() {
}
public AddressMessage(Integer id, String street, String country) {
this.id = id;
this.street = street;
this.country = country;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((street == null) ? 0 : street.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AddressMessage other = (AddressMessage) obj;
if (country == null) {
if (other.country != null)
return false;
} else if (!country.equals(other.country))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (street == null) {
if (other.street != null)
return false;
} else if (!street.equals(other.street))
return false;
return true;
}
}
2. the mdb bean AddressMDB.java:
package com.sillycat.mdb;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import com.sillycat.mdb.entities.AddressMessage;
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/AddressQueue") })
public class AddressMDB implements MessageListener {
@Resource
private MessageDrivenContext mdc;
public void onMessage(Message msg) {
try {
if (msg instanceof ObjectMessage) {
ObjectMessage message = (ObjectMessage) msg;
AddressMessage addressMessage = null;
addressMessage = (AddressMessage) message.getObject();
System.out.println("street:" + addressMessage.getStreet());
}
} catch (Exception e) {
e.printStackTrace();
mdc.setRollbackOnly();
}
}
}
3. the Client bean AddressMessageClient.java:
package com.sillycat.mdb;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.naming.InitialContext;
import com.sillycat.mdb.entities.AddressMessage;
public class AddressMessageClient {
public static void main(String[] args) throws Exception {
QueueConnection cnn = null;
QueueSender sender = null;
QueueSession session = null;
InitialContext ctx = new InitialContext();
Queue queue = (Queue) ctx.lookup("queue/AddressQueue");
QueueConnectionFactory factory = (QueueConnectionFactory) ctx
.lookup("ConnectionFactory");
cnn = factory.createQueueConnection();
session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
sender = session.createSender(queue);
ObjectMessage address_message = session.createObjectMessage();
AddressMessage addressMessage = new AddressMessage();
addressMessage.setStreet("三官堂");
addressMessage.setCountry("China");
address_message.setObject(addressMessage);
sender.send(address_message);
System.out.println("Message sent successfully to remote queue.");
}
}
4.the configura xml in E:\jboss-5.1.0.GA\server\default\deploy\messaging\destinations-service.xml
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=AddressQueue"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="JNDIName">queue/AddressQueue</attribute>
<attribute name="RedeliveryDelay">10000</attribute>
<attribute name="MaxDeliveryAttempts">3</attribute>
</mbean>
1. The message Bean trans from the point to point, AddressMessage.java:
package com.sillycat.mdb.entities;
import java.io.Serializable;
public class AddressMessage implements Serializable {
private static final long serialVersionUID = 3887312094158862657L;
private Integer id;
private String street;
private String country;
public AddressMessage() {
}
public AddressMessage(Integer id, String street, String country) {
this.id = id;
this.street = street;
this.country = country;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((street == null) ? 0 : street.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AddressMessage other = (AddressMessage) obj;
if (country == null) {
if (other.country != null)
return false;
} else if (!country.equals(other.country))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (street == null) {
if (other.street != null)
return false;
} else if (!street.equals(other.street))
return false;
return true;
}
}
2. the mdb bean AddressMDB.java:
package com.sillycat.mdb;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import com.sillycat.mdb.entities.AddressMessage;
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/AddressQueue") })
public class AddressMDB implements MessageListener {
@Resource
private MessageDrivenContext mdc;
public void onMessage(Message msg) {
try {
if (msg instanceof ObjectMessage) {
ObjectMessage message = (ObjectMessage) msg;
AddressMessage addressMessage = null;
addressMessage = (AddressMessage) message.getObject();
System.out.println("street:" + addressMessage.getStreet());
}
} catch (Exception e) {
e.printStackTrace();
mdc.setRollbackOnly();
}
}
}
3. the Client bean AddressMessageClient.java:
package com.sillycat.mdb;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.naming.InitialContext;
import com.sillycat.mdb.entities.AddressMessage;
public class AddressMessageClient {
public static void main(String[] args) throws Exception {
QueueConnection cnn = null;
QueueSender sender = null;
QueueSession session = null;
InitialContext ctx = new InitialContext();
Queue queue = (Queue) ctx.lookup("queue/AddressQueue");
QueueConnectionFactory factory = (QueueConnectionFactory) ctx
.lookup("ConnectionFactory");
cnn = factory.createQueueConnection();
session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
sender = session.createSender(queue);
ObjectMessage address_message = session.createObjectMessage();
AddressMessage addressMessage = new AddressMessage();
addressMessage.setStreet("三官堂");
addressMessage.setCountry("China");
address_message.setObject(addressMessage);
sender.send(address_message);
System.out.println("Message sent successfully to remote queue.");
}
}
4.the configura xml in E:\jboss-5.1.0.GA\server\default\deploy\messaging\destinations-service.xml
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=AddressQueue"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="JNDIName">queue/AddressQueue</attribute>
<attribute name="RedeliveryDelay">10000</attribute>
<attribute name="MaxDeliveryAttempts">3</attribute>
</mbean>
发表评论
-
Update Site will come soon
2021-06-02 04:10 1677I am still keep notes my tech n ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 431Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 436Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 374Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 455VPN Server 2020(2)Docker on Cen ... -
Nginx Deal with OPTIONS in HTTP Protocol
2020-02-15 01:33 356Nginx Deal with OPTIONS in HTTP ... -
PDF to HTML 2020(1)pdftohtml Linux tool or PDFBox
2020-01-29 07:37 405PDF to HTML 2020(1)pdftohtml Li ... -
Elasticsearch Cluster 2019(2)Kibana Issue or Upgrade
2020-01-12 03:25 720Elasticsearch Cluster 2019(2)Ki ... -
Spark Streaming 2020(1)Investigation
2020-01-08 07:19 295Spark Streaming 2020(1)Investig ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 294Hadoop Docker 2019 Version 3.2. ... -
MongoDB 2019(3)Security and Auth
2019-11-16 06:48 241MongoDB 2019(3)Security and Aut ... -
MongoDB 2019(1)Install 4.2.1 Single and Cluster
2019-11-11 05:07 294MongoDB 2019(1) Follow this ht ... -
Monitor Tool 2019(1)Monit Installation and Usage
2019-10-17 08:22 325Monitor Tool 2019(1)Monit Insta ... -
Ansible 2019(1)Introduction and Installation on Ubuntu and CentOS
2019-10-12 06:15 312Ansible 2019(1)Introduction and ... -
Timezone and Time on All Servers and Docker Containers
2019-10-10 11:18 332Timezone and Time on All Server ... -
Kafka Cluster 2019(6) 3 Nodes Cluster on CentOS7
2019-10-05 23:28 283Kafka Cluster 2019(6) 3 Nodes C ... -
K8S Helm(1)Understand YAML and Kubectl Pod and Deployment
2019-10-01 01:21 326K8S Helm(1)Understand YAML and ... -
Rancher and k8s 2019(5)Private Registry
2019-09-27 03:25 362Rancher and k8s 2019(5)Private ... -
Jenkins 2019 Cluster(1)Version 2.194
2019-09-12 02:53 444Jenkins 2019 Cluster(1)Version ... -
Redis Cluster 2019(3)Redis Cluster on CentOS
2019-08-17 04:07 373Redis Cluster 2019(3)Redis Clus ...
相关推荐
JBOSS5.1安装配置说明 JBOSS 是一个基于 Java 的开源应用服务器,可以运行在 Windows、Linux、Unix 等多种操作系统平台上。为了在 Windows 下安装和配置 JBOSS,我们需要按照以下步骤进行操作。 安装 JAVA 环境 ...
JBoss 5.1 是一个基于 Java 的应用服务器,提供了高度可扩展性和高可用性,支持集群部署。集群操作能够使多个 JBoss 实例协同工作,以提高应用程序的性能和容错能力。Apache 2.2.4 是一个常用的开源 Web 服务器,它...
在本课程测试代码中,我们将探讨如何在Eclipse集成开发环境(IDE)下使用Apache Ant构建工具,配合JBoss 5.1应用服务器进行EJB的开发和部署。 【Eclipse】是广泛使用的开源Java IDE,支持多种Java项目类型,包括EJB...
本文是作者精心写作的完整配置搭建Jboss-5.1集群的文档,只要按照步骤来做绝对不会出错,一些重要部分俺还加以标注和详细说明,呕心沥血的一大完整安装文档.
除了加入jboss-web.xml,删除xerces-2.6.2.jar和xml-apis.jar之外, <!... <jboss-web> <!-- For load class ...原因是旧版本的slf4j-api不包含以上方法,附件解压后覆盖jboss5.1GA/common/lib下的同名文件即可
**JBoss Drools 5.1 中文使用说明** Drools 是一个开源的规则引擎,它提供了基于Java的业务规则管理系统(BRMS),帮助企业快速实施复杂的业务逻辑。本文档将详细阐述JBoss Drools 5.1版本的使用方法和特性。 ### ...
jboss是一个基于J2EE的开放源代码的应用服务器。 JBoss代码遵循LGPL许可,可以在任何商业应用中免费使用。JBoss是一个管理EJB的容器和服务器,支持EJB 1.1、EJB 2.0和EJB3的规范。但JBoss核心服务不包括支持servlet/...
JBOSS旧版本(3~6)下载地址、JBOSS旧版本(3~6)下载地址、JBOSS旧版本(3~6)下载地址、JBOSS旧版本(3~6)下载地址
jboss-5.1.0.GA, 因为太大了,我分了两部分上传,这是第一部分,我把里面的service目录的内容放到第二部分了,下载的时候 记得我的上传目录找第二部分资源,然后解压到server目录 便可
这个驱动程序应该被添加到JBoss的类路径中,通常是`JBOSS_HOME/server/default/lib`目录。 2. **环境变量设置**:设置两个环境变量,`CLASSPATH`和`JBOSS_HOME`,以确保JBoss能找到所需的库文件和启动配置。 3. **...
**JBoss 安装成 Windows 服务的详细指南** JBoss 是一个开源的应用服务器,它提供了基于Java EE的平台来部署和管理企业级应用程序。在Windows操作系统上将JBoss安装为服务,可以让JBoss在系统启动时自动启动,提供...
当遇到"JBoss JTA configuration trouble shooting"的问题时,开发者通常需要深入理解JTA的工作原理以及如何在JBoss应用服务器中正确配置它。以下是对这个主题的详细讲解: 首先,JTA是一个Java标准,定义了API来...
2. JBoss服务器的配置文件:JBoss的配置主要涉及配置文件,通常位于“JBOSS_HOME/standalone/configuration”路径下,其中“standalone.xml”是JBoss服务器运行时使用的主要配置文件,而“standalone-full.xml”则是...
1. 运行 JBoss:`/usr/local/jboss/bin/run.sh -b 10.0.0.133`,其中 `-b` 选项指定了 JBoss 的绑定地址。 JBoss 的优点: 1. 免费、开放源代码的 J2EE 实现,遵循 LGPL 许可证。 2. 需要的内存和硬盘空间比较小...
本文将详细讲解如何在Eclipse集成开发环境中使用XFire生成Web服务,并在JBoss 5.1应用服务器上进行部署和运行。 首先,我们需要理解Web服务的基本概念。Web服务是基于开放标准(如SOAP、WSDL和UDDI)的自包含、自...
jboss的文件。。希望大家都能下载学习。。。
在我们的项目中,使用的是 Spring 2.5 版本,但是在 JBoss 5.1 中,可能会出现版本不兼容的问题。解决这个问题的方法是,在 WEB-INF 目录下添加一个名为 jboss-web.xml 的文件,并在其中配置 class-loading 信息。 ...