导航:首页 > 编程语言 > javawebspheremq

javawebspheremq

发布时间:2022-06-28 10:55:30

Ⅰ 有关websphere mq问题

int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING;
myQMgr = new MQQueueManager ("QM1");
myQueue = myQMgr.accessQueue("TESTQ", openOptions);
MQMessage myMsg = new MQMessage ();
myMsg.messageFlags = MQC.MQMF_SEGMENTATION_ALLOWED;
MQPutMessageOptions pmo = new MQPutMessageOptions ();
String strMsg = "";
for (int i=0;i<=100;i++)
strMsg = strMsg + "Hello";
myMsg.write(strMsg.getBytes());
myQueue.put(myMsg,pmo);
System.out.println("Put message:\n" + strMsg);
myQueue.close();
myQMgr.disconnect();
QMgrSegReceiver.java
int openOptions = MQC.MQOO_INPUT_SHARED | MQC.MQOO_FAIL_IF_QUIESCING;
myQMgr = new MQQueueManager ("QM1");
myQueue = myQMgr.accessQueue("TESTQ", openOptions);
MQMessage myMsg = new MQMessage ();
MQGetMessageOptions gmo = new MQGetMessageOptions ();
gmo.options = MQC.MQGMO_COMPLETE_MSG;
myQueue.get(myMsg, gmo);
byte[] b = new byte[myMsg.getMessageLength()];
myMsg.readFully(b);
String strMsg = new String(b);
System.out.println("Got message:\n" + strMsg);
myQueue.close();
myQMgr.disconnect();

Ⅱ websphere MQ JAVA 传输文件

QMgrSegSender.java:
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING;
myQMgr = new MQQueueManager ("QM1");
myQueue = myQMgr.accessQueue("TESTQ", openOptions);
MQMessage myMsg = new MQMessage ();
myMsg.messageFlags = MQC.MQMF_SEGMENTATION_ALLOWED;
MQPutMessageOptions pmo = new MQPutMessageOptions ();
String strMsg = "";
for (int i=0;i<=100;i++)
strMsg = strMsg + "Hello";
myMsg.write(strMsg.getBytes());
myQueue.put(myMsg,pmo);
System.out.println("Put message:\n" + strMsg);
myQueue.close();
myQMgr.disconnect();
QMgrSegReceiver.java:
int openOptions = MQC.MQOO_INPUT_SHARED | MQC.MQOO_FAIL_IF_QUIESCING;
myQMgr = new MQQueueManager ("QM1");
myQueue = myQMgr.accessQueue("TESTQ", openOptions);
MQMessage myMsg = new MQMessage ();
MQGetMessageOptions gmo = new MQGetMessageOptions ();
gmo.options = MQC.MQGMO_COMPLETE_MSG;
myQueue.get(myMsg, gmo);
byte[] b = new byte[myMsg.getMessageLength()];
myMsg.readFully(b);
String strMsg = new String(b);
System.out.println("Got message:\n" + strMsg);
myQueue.close();
myQMgr.disconnect();

Ⅲ 第三方中间件MQ、websphere、webSphere的作用和应用场景

MQ处理消息的,在分布环境下扩展进程间的通信,并支持多通讯协议、语言、应用程序、硬件和软件平台。如果消息队列较多可以用这个

WebLogic是用于开发、集成、部署和管理大型分布式Web应用、网络应用和数据库应用的Java应用服务器,基于J2EE,一般用在电子商务系统。
WebSphere 是一个模块化的平台,可以在许多平台上运行,包括 Intel、Linux 和 z/OS。它可以创建高效的电子商务站点提高了网上交易的质量和数量。 把应用扩展到联合的移动设备上使销售人员可以为客户提供更方便、更快捷的服务。 整合已有的应用并提供自动简捷的业务流程。

Ⅳ WebSphere MQ中的队列有几种啊

可以简单的把队列看作一个容器,用来存放消息。队列按其定义来分,可以分成本地队列、远程队列、别名队列和模型队列。其中本地队列是真正意义上的队列实体,可以用来存放消息。而远程队列和别名队列只是一种队列的定义,指向另一个队列实体。其中远程队列指向的是其他队列管理器中的队列,而别名队列指向的是本地队列管理器中的队列。模型队列有一点特殊,它虽然本身只是一个队列的定义,描述了模型的属性,但是当打开模型队列的时候,队列管理其就会以这个定义为模型,创建一个本地队列,被成为动态队列。

一个队列管理器可以管辖多个队列。但对于一个队列只能隶属于其中的一个队列管理器。所以队列在其所隶属于的队列管理器只能有唯一的名字,不能于同一个管理器中的其他的队列重名。当消息添加到队列中是,其缺省被添加到最后。删除消息时从头开始。

(1)本地队列:本地队列按照功能又可以分为初始化队列、传输队列、目标队列和死信队列。其中初始化队列用作消息触发。传输队列只是暂存待传的消息,在条件许可的情况下,通过管道将消息传送其他的队列管理器。目标队列是消息的目的地,可以长期存放信息。如果消息不能送达目标队列,也不能路由出去,则被自动放入死信队列。命令队列指的是WebSphere MQ队列管理器预定义的SYSTEM.ADMIN.COMMAND.QUEUE,任何的MQSC命令都可以发往改队列,并被队列管理器的命令服务器(Command Server)接受处理。

MQXQH(传输信息头,其中的RemoteQName和RemoteQMgrName两个域指名了目标队列和目标队列管理器)

MQDLH(死信信息头,其中DestQName和DestQMgrName两个域指名了原消息的目标队列和目标队列管理器,Reason域指名了消息无法投递的原因)。

MQMD(应答消息头,其中ReplyToQ和ReplyToMgr分别表示应答队列和应答队列管理器)

(2)别名队列:别名队列的TARGQ属性指名了其代表的目标队列名称,目标队列通常是本地队列。可以将别名队列理解为指针。

(3) 远程队列:远程队列也是一个定义,使用了远程队列,你就可以不用知道目标队列所在的队列管理器了。

(4) 模型队列:模型队列定义了一套本地队列的属性集合。一旦打开模型队列,队列管理器就会按照这些属性动态创建处一个本地队列。模型队列的DEFTYPE属性可以取值为PERMDYN和TEMPDYN分别代表永久动态度列和临时动态队列。

Ⅳ websphere mq是什么

IBM WebSphere MQ 是IBM公司提供的基于消息队列的消息中间件。

国内相应的产品也有很多,如东方通科技的TONG-LinkQ等。

消息中间件服务于服务器间的消息传递,并通过消息队列机制保障其传输的稳定性。

Ⅵ java怎么将mq接收的文件消息提取出来

WebSphere MQ 接收发送
添加mq jar
类介绍:
SendMSG:消息发送类。
Main():主方法。
SendMSG():消息发送方法。
方法描述:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

package test;
public class SendMSG{
MQEnvironment.hostname = "192.168.10.201";
//通道类型为服务器连接通道
MQEnvironment.channel = "tong";
MQEnvironment.CCSID = 1381;
//消息队列端口号
MQEnvironment.port = 10618;
try{
//建立队列管理器QM_SERVER为队列管理器名称
MQQueueManager qMgr = new MQQueueManager("test");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF|MQC.MQOO_OUTPUTMQC.MQOO_INQUIRE;//建立队列INITQ队列名称INITQ为本地队列
MQQueue queue = qMgr.accessQueue("wanghui",openOptions,null,null,null);
System.out.println("成功建立通道");
MQMessage message = new MQMessage();
message.format = MQC.MQFMT_STRING;
message.characterSet = 1381;
message.writeString("王辉");
message.expiry = -1;//设置消息用不过期
queue.put(message);//将消息放入队列
queue.close();//关闭队列
qMgr.disconnect();//断开连接
}catch(EOFExceptione){
e.printStackTrace();
}catch(MQExceptione){
e.printStackTrace();
}catch(Exceptione){
e.printStackTrace();
}
}

ReceiveMSG:消息接收类。
Main():主方法。
ReceiveMSG():消息接收方法。

public class ReceiveMSG {
MQEnvironment.hostname="192.168.10.201";//通道类型为服务器连接通道
MQEnvironment.channel="tong";
MQEnvironment.CCSID=1381;
MQEnvironment.port=10618;
try{
//建立队列管理器QM_SERVER为队列管理器名称
MQQueueManager qMgr = new MQQueueManager("test");
int openOptions=MQC.MQOO_INPUT_AS_Q_DEF|MQC.MQOO_OUTPUT|MQC.MQOO_INQUIRE;//建立队列INITQ队列名称INITQ为本地队列
MQQueue queue=qMgr.accessQueue("wanghui",openOptions,null,null,null);
System.out.println("成功建立通道");
MQMessage message= new MQMessage();
message.format=MQC.MQFMT_STRING;
message.characterSet=1381;
//从队列中获取消息
MQGetMessage Optionspmo=new MQGetMessageOptions();
queue.get(message,pmo);
Stringchars=message.readLine();
System.out.println(chars);
queue.close();//关闭队列
qMgr.disconnect();//断开连接
}catch(EOFExceptione){
e.printStackTrace();
}catch(MQExceptione){
e.printStackTrace();
}catch(Exceptione){
e.printStackTrace();
}
}

Ⅶ 如何在java中使用WebSphere MQ

websphere mq : 用于传输信息 具有跨平台的功能。
1 安装websphere mq 并启动
2 websphere mq 建立 queue Manager (如:MQSI_SAMPLE_QM)
3 建立queue 类型选择 Local类型 的 (如lq )
3 建立channels 类型选择Server Connection (如BridgeChannel)

java 代码如下:

package test.mq;
import com.ibm.mq.*;
/*
* 成功的访问mq 的java 类
*/
public class FirstMqTest {
// public static void main(String[] args[]){
// FirstMqTest first = new FirstMqTest();
// first.test();
// }
public static void main(String args[]){
FirstMqTest first = new FirstMqTest();
first.test();

}
public void test(){
String qManager = "MQSI_SAMPLE_QM"; //QueueManager name
String qName = "lq";//Queue Name
try {
//configure connection parameters
MQEnvironment.hostname="172.16.17.123";//MQ Server name or IP
//MQEnvironment.port=1414;//listenr port
MQEnvironment.channel="BridgeChannel";//Server-Connection Channel
MQEnvironment.CCSID =1381;
// Create a connection to the QueueManager
System.out.println("Connecting to queue manager: "+qManager);
MQQueueManager qMgr = new MQQueueManager(qManager);
// Set up the options on the queue we wish to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
System.out.println("Accessing queue: "+qName);
MQQueue queue = qMgr.accessQueue(qName, openOptions);
// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
// ... and write some text in UTF8 format
msg.writeUTF("Hello, World!");
// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message to the queue
System.out.println("Sending a message...");

/*
* 在此测试一下 mq 的传输次列
*
*/
for(int j=0;j< 5;j++){
String str ="test11111111111";
str = str+j;
msg.writeUTF(str);
queue.put(msg, pmo);
}
queue.put(msg, pmo);
// Now get the message back again. First define a WebSphere MQ message
// to receive the data
MQMessage rcvMessage = new MQMessage();

// Specify default get message options
MQGetMessageOptions gmo = new MQGetMessageOptions();
// Get the message off the queue.
System.out.println("...and getting the message back again");
queue.get(rcvMessage, gmo);
// And display the message text...
String msgText = rcvMessage.readUTF();
System.out.println("The message is: " + msgText);
// Close the queue
System.out.println("Closing the queue");
queue.close();
// Disconnect from the QueueManager
System.out.println("Disconnecting from the Queue Manager");
qMgr.disconnect();
System.out.println("Done!");
}
catch (MQException ex) {
System.out.println("A WebSphere MQ Error occured : Completion Code "
+ ex.completionCode + " Reason Code " + ex.reasonCode);
}
catch (java.io.IOException ex) {
System.out.println("An IOException occured whilst writing to the message buffer: "
+ ex);
}
}
}

Ⅷ websphere和mq是啥关系

WebSphere 是 IBM 的软件平台。WebSphere Application Server 是WebSphere 的核心基础,在这个共同的基础上产生了很多种产品。MQ中间件就是这些产品种的一种而已,所以通常称WEBSHPERE MQ。
不知道这么说,你能理解不?

阅读全文

与javawebspheremq相关的资料

热点内容
成都市区建成面积算法 浏览:656
智能家居单片机 浏览:93
买男装用什么app好 浏览:851
文件夹合并了怎么拆开 浏览:256
波段副图源码无未来函数 浏览:84
livecn服务器地址 浏览:257
程序员这个工作真的很吃香吗 浏览:844
程序员和数学分析师待遇 浏览:678
压缩气弹簧怎么拆 浏览:321
华为公有云服务器添加虚拟ip 浏览:209
程序员和运营哪个累 浏览:24
抖音安卓信息提示音怎么设置 浏览:454
光速虚拟机的共享文件夹 浏览:248
程序员培训机构发的朋友圈真实性 浏览:742
天干地支简单算法 浏览:299
下载个压缩文件 浏览:300
普通人电脑关机vs程序员关机 浏览:628
米酷建站源码 浏览:115
氢气app怎么搜搭配 浏览:619
pdf绿盟 浏览:505