예제 #1
0
파일: server.php 프로젝트: sdnnfv/qpid
     pn_session_open($ssn);
     $ssn = pn_session_next($ssn, PN_LOCAL_UNINIT);
 }
 // setup any new links
 $lnk = pn_link_head($conn, PN_LOCAL_UNINIT);
 while ($lnk) {
     $tgt = pn_remote_target($lnk);
     $src = pn_remote_source($lnk);
     if (pn_is_sender($lnk)) {
         print "Outgoing Link: {$src} -> {$tgt}\n";
     } else {
         print "Incoming Link: {$tgt} <- {$src}\n";
     }
     pn_set_target($lnk, $tgt);
     pn_set_source($lnk, $src);
     pn_link_open($lnk);
     if (pn_is_sender($lnk)) {
         pn_delivery($lnk, "delivery-{$counter}");
         $counter++;
     } else {
         pn_flow($lnk, 10);
     }
     $lnk = pn_link_next($lnk, PN_LOCAL_UNINIT);
 }
 // process all deliveries on the work queue
 // deliveries might be in the work queue for three reasons
 //  - they are readable (incoming only)
 //  - they are writable (outgoing only)
 //  - their disposition is updated  (either)
 $delivery = pn_work_head($conn);
 while ($delivery) {
예제 #2
0
파일: client.php 프로젝트: sdnnfv/qpid
}
// set up a session with a sender and receiver
$conn = pn_connection();
pn_connector_set_connection($c, $conn);
pn_connection_set_hostname($conn, "rschloming.servicebus.appfabriclabs.com");
pn_connection_set_container($conn, "asdf");
$ssn = pn_session($conn);
$snd = pn_sender($ssn, "sender");
pn_set_target($snd, "queue1");
$rcv = pn_receiver($ssn, "receiver");
pn_set_source($rcv, "queue1");
// open all the endpoints
pn_connection_open($conn);
pn_session_open($ssn);
pn_link_open($snd);
pn_link_open($rcv);
// set up an initial delivery
pn_delivery($snd, "delivery-{$counter}");
$counter++;
// allocate some initial credit
pn_flow($rcv, min($count ? $count : 10, 10));
$done = false;
while (!$done) {
    // wait until there is an active connector or listener
    pn_driver_wait($driver, -1);
    // cycle through all connectors with I/O activity
    while ($c = pn_driver_connector($driver)) {
        // process work due to I/O events
        pn_connector_process($c);
        $h = pn_connector_context($c);
        $h($c);