Please disable Adblockers and enable JavaScript for domain CEWebS.cs.univie.ac.at! We have NO ADS, but they may interfere with some of our course material.
Correlator Logic
• Idea
Idea
The Idea of a correlator is to collect messages and RELIABLY relay them to (in the case of a process management system) to correct instances, or in other words: to the party that needs them.
- Some instances wait (now or in the future) for messages. Messages have to be stored and/or relayed when the instance is ready.
- Some messages may create new instances.
Why do correlators (or message brokers) exist
See Daniel Ritters (SAP) slides.
What to do?
- create the correlator.php that collects every input (use e.g. handleREST.php) and saves it to a LOG (also PUT/GET/POST/DELETE, all parameters and all headers).
- register correlator.php
- wait until you get some messages (and start the process)
- You should get messages every 30 minutes (including a 3 hour break between 5-8 in the morning)
- the messages (1) which you get should create an instance
- POST to http://cpee.org:9296 with a parameter xml that contains the process template. This creates a process instance (2)
- Details: «http://cpee.org:9296/?riddl-description»
- the process runs then automatically, YOUR correlation.php gets a correlation message (2): a certain instance waits for a certain message.
- With the help of this correlation message, the correlator decides if a message is suitable for a certain instance.
- The correlation rule consists of:
- ID of an Instance (endpoint where to forward the message) - IF A MESSAGE ARRIVES, WHERE TO SEND IT?
- Critera - IF A MESSAGE ARRIVES, HOW TO FIND OUT TO WHOM I SHOULD FORWARD IT (e.g. has to contain an order number)
- If a rule applies (a certain message is identified to match a rule), it can be deleted (when the correlator is sure it arrived).
- Finally messages arrive (4)
Summary fuer correlator.php
- logs all messages
- instantiation message 4a creates new instance
- correlation messages 2 contain rules that are compared to all stored messages 4b. If no messages 4b are found, the rules from messages 2 are saved and compared to all messages 4 that arrive later.
How to post a file in PHP
<?php
$eol = "\r\n";
$mime_boundary=md5(time());
// $data .= '--' . $mime_boundary . $eol;
// $data .= 'Content-Disposition: form-data; name="inputfeld"' . $eol . $eol;
// $data .= "Meine Eingage" . $eol;
$data = '';
$data .= '--' . $mime_boundary . $eol;
$data .= 'Content-Disposition: form-data; name="xml"; filename="filename.xml"' . $eol;
$data .= 'Content-Type: text/xml' . $eol;
$data .= 'Content-Transfer-Encoding: base64' . $eol . $eol;
$data .= chunk_split(base64_encode("<myxml>aaaa</myxml>")) . $eol; // mit file_get_contents von der platte holen
$data .= "--" . $mime_boundary . "--" . $eol . $eol; // zwei eol um server zu zeigen dass ich nix mehr senden will!
$opts = array('http' => array(
'method' => 'POST',
'header' => 'Content-Type: multipart/form-data; boundary=' . $mime_boundary . $eol,
'content' => $data
));
header('content-type: text/plain');
$context = stream_context_create($opts);
$result = file_get_contents('http://cpee.org:9296',false,$context);
print_r($result);
?>
Letzte Änderung: 19.05.2020, 21:32 | 421 Worte