没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|使用教程|编辑:郝浩|2013-04-25 11:06:38.000|阅读 695 次
概述: 高级队列(AQ)是内置在Oracle服务器上的一个灵活的信息交流机制,使用这个高级队列,你可以将来自一个工作站或服务器的信息发送到一个或是多个工作站上。dotConnect for Oracle采用类集合来充分的利用这项技术。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
高级队列(AQ)是内置在Oracle服务器上的一个灵活的信息交流机制,使用这个高级队列,你可以将来自一个工作站或服务器的信息发送到一个或是多个工作站上。dotConnect for Oracle采用类集合来充分的利用这项技术。
首先来看一下高级队列(AQ),主要通过下面的几部分来具体的了解:
高级队列提供了数据库集成的消息队列功能,高级队列信息可以持久存储、不同数据或是数据库上队列之间的传播、使用Oracle网络服务的传输、HTTP、SMTP。
由于Oracle高级队列是在数据库表上实现的,高可用性、可扩展性和可靠性完全适用于队列的数据。这项技术是由DBMS_AQ 和DBMS_AQADM2个包实现,DBMS_AQ包管理队列的信息,如入队和出队,DBMS_AQADM则是负责管理生命周期以及属性。
支持标准的数据库功能,如恢复、重启、安全性、以及队列表的导入好和导出,还支持信息管理功能和异步通信功能。
下面是AQ的两种功能模式:点对点模型和发布订阅模型。在第一个中,将会有应用程序发送消息到队列(称为enqueuing),以及一个用于退出队列信息的用户应用程序(称为dequeuing)。可以有多个用户应用程序,但是任何的一条信息只能够读取一次,同时用户可以浏览没有退出队列的信息。

在发布订阅模型中,有一些入队和出队信息的应用程序,这些信息可以是针对特定的应用程序,或是被目的地所接收,应用程序接信息也被称为代理。

dotConnect for Oracle中有一些类用于提供AQ功能,这些类主要是以下几种:
OracleQueueMessage对象主要是代表了队列信息,主要被用于排队信息的参数,并被出对的方法返回。
OracleQueueMessages包含了系统生成的消息标志符和消息载荷,是char或用户定义的对象类型。
在这里有一个点到点的消息扩展的示例,方便大家理解:
[C#]
OracleConnection oracleConnection = new OracleConnection(
"User Id=system;Password=manager;Server=ora;");
oracleConnection.Open();
OracleQueueTable oracleQueueTable = new OracleQueueTable(
"QUEUE_TABLE_MESSAGE", oracleConnection);
// Set sort order by priority for the queue.
// The messages with higher priority will reach the recipient first.
oracleQueueTable.Options.SortOrder = OracleQueueSortOrder.PriorityEnqueueTime;
// Specify type of the messages in the queue.
//This time each message will be represented by just a string object.
//We do so to simplify the unimportant details and concentrate on the advanced features of AQ
oracleQueueTable.Options.PayloadTypeName = "RAW";
// The following operations are same as in the previous example.
oracleQueueTable.CreateQueueTable();
OracleQueueAdmin oracleQueueAdmin = new OracleQueueAdmin("MESSAGE_QUEUE",
"QUEUE_TABLE_MESSAGE", oracleConnection);
oracleQueueAdmin.CreateQueue();
oracleQueueAdmin.StartQueue();
OracleQueue oracleEnqueueQueue = new OracleQueue("MESSAGE_QUEUE", oracleConnection);
// Create and send the first message.
OracleQueueMessage message1 = new OracleQueueMessage();
message1.StringPayload = "First message.";
message1.MessageProperties.Priority = 7;
oracleEnqueueQueue.Enqueue(message1);
// Create and send the second message. This message is assigned a higher priority value.
// The message will be consumed first, regardless of the fact that it was sent later.
OracleQueueMessage message2 = new OracleQueueMessage();
message2.StringPayload = "Second message with high priority.";
message2.MessageProperties.Priority = 1;
oracleEnqueueQueue.Enqueue(message2);
// Create an object that receives the two messages.
OracleQueue oracleDequeueQueue = new OracleQueue("MESSAGE_QUEUE", oracleConnection);
oracleDequeueQueue.DequeueOptions.WaitTimeout = 1;
// Retrieve the messages in a loop. Once there are two messages received, quit.
// (ex.Code == 25228) specifies that the error occured is ORA-25228; it is thrown when the dequeuing timeout expires
// or the end of the queue is reached without dequeuing a message.
int messageCount = 0;
while (messageCount < 2) {
try {
OracleQueueMessage msg = oracleDequeueQueue.Dequeue();
messageCount++;
if (msg != null && msg.StringPayload != null) {
Console.WriteLine(msg.StringPayload);
}
}
catch(OracleException ex) {
if (ex.Code == 25228) {
continue;
}
else
throw ex;
}
}
//Stop and destroy the queue and the queue table
oracleQueueAdmin.StopQueue();
oracleQueueAdmin.DropQueue();
oracleQueueTable.DropQueueTable();
oracleConnection.Close();
[Visual Basic]
Dim oracleConnection As New OracleConnection((
"User Id=system;Password=manager;Server=ora;")
oracleConnection.Open()
Dim oracleQueueTable As New OracleQueueTable("QUEUE_TABLE_MESSAGE", oracleConnection)
' Set sort order by priority for the queue.
' The messages with higher priority will reach the recipient first.
oracleQueueTable.Options.SortOrder = OracleQueueSortOrder.PriorityEnqueueTime
' Specify type of the messages in the queue. This time each message will be represented by just a string object.
' We do so to simplify the unimportant
oracleQueueTable.Options.PayloadTypeName = "RAW"
' The following operations are same as in the previous example.
oracleQueueTable.CreateQueueTable()
Dim oracleQueueAdmin As New OracleQueueAdmin("MESSAGE_QUEUE", _
"QUEUE_TABLE_MESSAGE", oracleConnection)
oracleQueueAdmin.CreateQueue()
oracleQueueAdmin.StartQueue()
Dim oracleEnqueueQueue As New OracleQueue("MESSAGE_QUEUE", oracleConnection)
' Create and send the first message.
Dim message1 As New OracleQueueMessage
message1.StringPayload = "First message."
message1.MessageProperties.Priority = 1
oracleEnqueueQueue.Enqueue(message1)
' Create and send the second message. This message is assigned a higher priority value.
' The message will be consumed first, regardless of the fact that it was sent later.
Dim message2 As New OracleQueueMessage
message2.StringPayload = "Second message with high priority."
message2.MessageProperties.Priority = 7
oracleEnqueueQueue.Enqueue(message2)
' Create an object that receives the two messages.
Dim oracleDequeueQueue As New OracleQueue("MESSAGE_QUEUE", oracleConnection)
oracleDequeueQueue.DequeueOptions.WaitTimeout = 1
' Retrieve the messages in a loop. Once there are two messages received, quit.
' (ex.Code == 25228) specifies that the error occured is ORA-25228;
' it is thrown when the dequeuing timeout expires or the end of the queue is reached
' without dequeuing a message.
Dim messageCount As Integer = 0
Do While (messageCount < 2)
Try
Dim msg As OracleQueueMessage = oracleDequeueQueue.Dequeue()
messageCount += 1
if ((Not msg Is Nothing) AndAlso (Not msg.StringPayload Is Nothing)) Then
Console.WriteLine(msg.StringPayload)
End If
Catch ex As OracleException
If (ex.Code = 25228) Then
Continue Do
Else
Throw ex
End If
End Try
Loop
oracleQueueAdmin.StopQueue()
oracleQueueAdmin.DropQueue()
oracleQueueTable.DropQueueTable()
oracleConnection.Close()
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@ke049m.cn
文章转载自:慧都控件



注意: Cogent DataHub 软件 v11 包含一些新功能,您的目标操作系统可能不支持这些功能。
本教程主要为大家介绍如何使用DevExpress WinForms数据网格控件进行数据排序的基础知识,欢迎下载最新版组件体验!
在使用Parasoft C/C++test执行BugDetective数据流分析时,可能会遇到用户自定义的资源API,那在这种情况下,若要判断是否存在资源问题,如资源泄露等,则需要手动配置测试配置。
大型SaaS系统的自动化测试常常受制于界面变化快、结构复杂、加载机制多变等因素。从元素识别到脚本管理,SmartBear TestComplete帮助Salesforce建了可靠的自动化测试体系。
相关产品
dotConnect for Oracle不仅可以高效地连接到Oracle数据库,还提供了新的开发工具和技术。
最新文章 MORE
半岛外围网上直营相关的文章 MORE
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@ke049m.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
半岛外围网上直营