SAMConnection::connect

(PECL sam >= 0.1.0)
Establishes a connection to a Messaging Server
bool SAMConnection::connect ( string $protocol [, array $properties ] )

Calling the "connect" method on a SAMConnection object connects the PHP script to a messaging server. No messages can be sent or received until a connection is made.

Returns:

This method returns FALSE if an error occurs.

Examples:
Creating a connection to a Messaging Server using the IBM MQSeries protocol (WMQ)
1
2
3
4
5
<?php
 
$conn->connect(SAM_WMQ, array(SAM_HOST => 'Myhost.myco.com', SAM_PORT => 1506, SAM_BROKER => 'MyBroker'));
 
?>
Creating a connection with application transaction control and default host and port values
1
2
3
4
5
<?php
 
$conn->connect(SAM_WMQ, array(SAM_BROKER => 'MyBroker', SAM_TRANSACTIONS => SAM_MANUAL));
 
?>
Creating a connection to a Messaging Server using the IBM WebSphere Platform Messaging protocol (WPM)
1
2
3
4
5
6
<?php
 
$conn->connect(SAM_WPM, array(SAM_ENDPOINTS => 'localhost:7278:BootstrapBasicMessaging',
                              SAM_BUS => 'Bus1', SAM_TARGETCHAIN => 'InboundBasicMessaging'));
 
?>
See also:

SAMConnection::isConnected -

SAMConnection::disconnect -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.