Home Database Mysql Tutorial TIBCO ESB实战系列:TIBCO数据库适配器双向数据同步解决方案

TIBCO ESB实战系列:TIBCO数据库适配器双向数据同步解决方案

Jun 07, 2016 pm 03:11 PM
Actual combat data database series adapter

作者:任成钢 来源:TechTarget中国 原文:http://www.searchsoa.com.cn/showcontent_48908.htm 【TechTarget中国原创】 首先声明,我不是某个厂商的托儿,只是就自己目前从事的咨询工作经验,希望能为大家提供一种参考。下面就给大家介绍一下一个基于TIBCO

作者:任成钢    来源:TechTarget中国
原文:http://www.searchsoa.com.cn/showcontent_48908.htm

 

【TechTarget中国原创】首先声明,我不是某个厂商的托儿,只是就自己目前从事的咨询工作经验,希望能为大家提供一种参考。下面就给大家介绍一下一个基于TIBCO数据库适配器的双向数据同步解决方案。

  工作原理

  TIBCO数据库适配器(TIBCO Adapter for Active Database),简称ADB,是一款非常优秀的关系型数据库数据发布与订阅适配器产品,结合TIBCO的其他应用集成产品(比如TIBCO BusinessWorks、TIBCO EMS等),能够通过简单的配置,就能够实现同构或者异构数据库之间的数据同步应用。TIBCO ADB的工作原理如下:

  ADB数据发布:

TIBCO ESB实战系列:TIBCO数据库适配器双向数据同步解决方案

  ADB在源数据表的数据库中,根据源表的格式建立发布表,并在源表上建立触发器,监测源表的数据变化(增删改),并将变化的数据插入到发布表中,ADB Agent会定时查询发布表(表中有一个发布状态标志,未发布的数据,即新数据状态为N),并将新插入发布表的数据发布出去(数据发布后,发布状态变为C)。发布的数据将由ADB Agent转换成消息发送给订阅方(TIBCO BW或者ADB订阅服务)。

  ADB数据订阅:

 TIBCO ESB实战系列:TIBCO数据库适配器双向数据同步解决方案

  ADB在目的数据表的数据库中,根据目的表的格式建立异常表,ADB Agent接收到发布方(TIBCO BW或者ADB发布服务)发送的消息,将其转换为数据,并根据数据中的操作标识(增删改),直接写入目的表中。当出现数据操作异常时,比如主键重复,数据类型错误等,造成目的表更新失败,会将错误的数据记录到异常表中。

  在配置ADB发布和订阅过程中,建立的表和触发器都由ADB自动完成,并提供脚本,用户可以根据需要进行修改。

  双向数据同步

  在进行数据同步类应用的实施过程中,经常会遇到双向同步的问题,比如两个数据库,任意一个数据库中的数据发生变化,都需要将数据同步给另一个库。这种情况下如果不进行限制,可能会出现数据同步循环问题,两边的数据不断的更新,不断的触发新的数据发布。幸运的是ADB提供了循环监测功能(Loop Detection),防止这种循环更新的发生。循环监测的原理如下:

  ADB在源表中增加了一个的特定字段(ADB_SOURCE),触发器会监测这个字段,如果该字段是由ADB的订阅服务更新的,则触发器不会将更新的数据插入发布表;如果该字段在数据更新时没有更新,则此数据是应用更新的,触发器会将数据插入到发布表,由发布服务进行发布。如下所示:

以下是引用片段:
CREATE OR REPLACE TRIGGER TRI_P_FILE AFTER INSERT OR DELETE OR UPDATE ON TAB_FILE
FOR EACH ROW
DECLARE
 updating_key_fields EXCEPTION;
BEGIN
 IF :NEW.ADB_SOURCE = 'T' THEN return;
 END IF;

 IF INSERTING THEN
 INSERT INTO P_STD_FILE_BACK VALUES (
  :NEW.FILE_ID,
  :NEW.FILE_NAME,
……
END TAB_FILE;
/

  利用这个新增的字段,限制触发器对发布表的更新,有效的限制了数据的循环更新问题。

  新的挑战

  但是在最近的一次实施中,遇到了新的问题。一家大型集团,有很多相对独立的子部门(公司),集团总部推广了一套系统,这套系统是各个单位(包括集团总部和子部门)独立部署的,并要求各个单位之间实现数据的实时/准实时同步,数据的更新可能发生在任何一个单位,其他的单位都需要接收到更新的数据并写入自己的数据库,形成双向同步。这种场景非常适合使用应用集成产品,我们向客户推荐了TIBCO BusinessWorks、TIBCO ADB,并使用TIBCO EMS作为消息服务器。但是在处理数据双向同步问题上,客户提出了更高的要求,这套系统已经开发并在部分单位运行了多年,按照TIBCO ADB默认的在源表增加字段的方式来处理双向同步情况,目前的系统可能会出现问题,他们也不想对现有的系统进行修改,所以要求不能修改源表的表结构。

  解决方案

  为了解决这个问题,我们提出了如下的解决方案:

  客户使用的数据库为Oracle数据库,基于Oracle的一些特性,我们不再使用增加字段的方式进行循环监测,改成采用区分用户的方式。即ADB操作Oracle数据表采用与业务系统不同的数据库用户,比如业务系统使用的数据库用户为business,ADB使用tibco。
然后对ADB生成的触发器脚本进行修改,加入如下(红色字体)的判断:

以下是引用片段:
CREATE OR REPLACE TRIGGER TRI_P_FILE AFTER INSERT OR DELETE OR UPDATE ON TAB_FILE
FOR EACH ROW
DECLARE
 updating_key_fields EXCEPTION;
BEGIN
 IF USER = 'TIBCO' THEN RETURN;
 END IF;
 IF INSERTING THEN
 INSERT INTO P_STD_FILE_BACK VALUES (
  :NEW.FILE_ID,
  :NEW.FILE_NAME,
……
END TAB_FILE;
/

  由此判断如果更新数据的用户是tibco,则当前数据时由ADB订阅服务进行更新的,不需要插入发布表进行发布(因为所有ADB订阅服务的数据来源都是其他的ADB发布服务);如果是非tibco用户,则数据是由业务系统进行更新的,需要插入发布表进行发布。

  通过上述方法,即可以不必修改数据结构实现双向数据同步的中的循环监测,避免循环更新。

  使用此种解决方案,要注意如下几个问题:

  首先要为ADB使用的数据库用户赋予CONNECT和RESOURCE角色,并赋予CREATE ANY TRIGGER权限

  其次要为ADB使用的用户赋予业务表的操作权限,比如:

以下是引用片段:
  grant select, insert, update, delete on  TAB_FILE  to TIBCO;

  该操作由业务系统用户执行

  然后为了更方便的再业务表上建立触发器,要为业务表建立同义词,比如:

以下是引用片段:
  create synonym TAB_FILE  for BUSINESS. TAB_FILE;

  该操作由ADB操作用户执行

  最后使用ADB操作用户执行由ADB生成的发布表、异常表和触发器的脚本。

  至此,双向数据同步解决方案就此完成,完美的解决了客户提出的问题。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Slow Cellular Data Internet Speeds on iPhone: Fixes Slow Cellular Data Internet Speeds on iPhone: Fixes May 03, 2024 pm 09:01 PM

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks Apr 29, 2024 pm 06:55 PM

I cry to death. The world is madly building big models. The data on the Internet is not enough. It is not enough at all. The training model looks like "The Hunger Games", and AI researchers around the world are worrying about how to feed these data voracious eaters. This problem is particularly prominent in multi-modal tasks. At a time when nothing could be done, a start-up team from the Department of Renmin University of China used its own new model to become the first in China to make "model-generated data feed itself" a reality. Moreover, it is a two-pronged approach on the understanding side and the generation side. Both sides can generate high-quality, multi-modal new data and provide data feedback to the model itself. What is a model? Awaker 1.0, a large multi-modal model that just appeared on the Zhongguancun Forum. Who is the team? Sophon engine. Founded by Gao Yizhao, a doctoral student at Renmin University’s Hillhouse School of Artificial Intelligence.

The U.S. Air Force showcases its first AI fighter jet with high profile! The minister personally conducted the test drive without interfering during the whole process, and 100,000 lines of code were tested for 21 times. The U.S. Air Force showcases its first AI fighter jet with high profile! The minister personally conducted the test drive without interfering during the whole process, and 100,000 lines of code were tested for 21 times. May 07, 2024 pm 05:00 PM

Recently, the military circle has been overwhelmed by the news: US military fighter jets can now complete fully automatic air combat using AI. Yes, just recently, the US military’s AI fighter jet was made public for the first time and the mystery was unveiled. The full name of this fighter is the Variable Stability Simulator Test Aircraft (VISTA). It was personally flown by the Secretary of the US Air Force to simulate a one-on-one air battle. On May 2, U.S. Air Force Secretary Frank Kendall took off in an X-62AVISTA at Edwards Air Force Base. Note that during the one-hour flight, all flight actions were completed autonomously by AI! Kendall said - "For the past few decades, we have been thinking about the unlimited potential of autonomous air-to-air combat, but it has always seemed out of reach." However now,

Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! May 06, 2024 pm 04:13 PM

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

Single card running Llama 70B is faster than dual card, Microsoft forced FP6 into A100 | Open source Single card running Llama 70B is faster than dual card, Microsoft forced FP6 into A100 | Open source Apr 29, 2024 pm 04:55 PM

FP8 and lower floating point quantification precision are no longer the "patent" of H100! Lao Huang wanted everyone to use INT8/INT4, and the Microsoft DeepSpeed ​​team started running FP6 on A100 without official support from NVIDIA. Test results show that the new method TC-FPx's FP6 quantization on A100 is close to or occasionally faster than INT4, and has higher accuracy than the latter. On top of this, there is also end-to-end large model support, which has been open sourced and integrated into deep learning inference frameworks such as DeepSpeed. This result also has an immediate effect on accelerating large models - under this framework, using a single card to run Llama, the throughput is 2.65 times higher than that of dual cards. one

2024 QS ranking released! Computer science MIT dominates the list, Tsinghua University is 11th, Peking University is 15th 2024 QS ranking released! Computer science MIT dominates the list, Tsinghua University is 11th, Peking University is 15th Apr 18, 2024 pm 09:04 PM

The 2024QS World University Rankings by Subject is here! Overall, there is little change from 2023. According to the official website information, the 2024QS World University Rankings by Subject covers 55 subdivisions and 5 major academic fields. A total of 1,559 universities participated in the ranking, 64 of which are new faces this year (that is, they will not appear in the 2023 ranking). Among these 64 colleges and universities, 14 are truly appearing for the first time. Among them is the University of Chinese Academy of Sciences. According to the refined subjects, Music is a new subject introduced this year. In addition, the data science and artificial intelligence rankings have been expanded, with 51 new universities added to the rankings. The top five in the overall list are: Massachusetts Institute of Technology, University of Cambridge, University of Oxford, and Harvard University

Xiaomi 15 series full codenames revealed: Dada, Haotian, Xuanyuan Xiaomi 15 series full codenames revealed: Dada, Haotian, Xuanyuan Aug 22, 2024 pm 06:47 PM

The Xiaomi Mi 15 series is expected to be officially released in October, and its full series codenames have been exposed in the foreign media MiCode code base. Among them, the flagship Xiaomi Mi 15 Ultra is codenamed "Xuanyuan" (meaning "Xuanyuan"). This name comes from the Yellow Emperor in Chinese mythology, which symbolizes nobility. Xiaomi 15 is codenamed "Dada", while Xiaomi 15Pro is named "Haotian" (meaning "Haotian"). The internal code name of Xiaomi Mi 15S Pro is "dijun", which alludes to Emperor Jun, the creator god of "The Classic of Mountains and Seas". Xiaomi 15Ultra series covers

Open-Sora comprehensive open source upgrade: supports 16s video generation and 720p resolution Open-Sora comprehensive open source upgrade: supports 16s video generation and 720p resolution Apr 25, 2024 pm 02:55 PM

Open-Sora has been quietly updated in the open source community. It now supports video generation up to 16 seconds, with resolutions up to 720p, and can handle text-to-image, text-to-video, image-to-video, and video-to-video of any aspect ratio. and the generation needs of infinitely long videos. Let's try it out. Generate a horizontal screen Christmas snow scene, post to B site and then generate a vertical screen, and use Douyin to generate a 16-second long video. Now everyone can have a screenwriting addiction. How to play? Guidance GitHub: https://github.com/hpcaitech/Open-Sora What’s even cooler is that Open-Sora is still all open source, including the latest model architecture, the latest model weights, multi-time/resolution/long-term

See all articles