(no version information, might be only in CVS)
SAMConnection->connect() -- Establishes a connection to a Messaging ServerCalling 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.
protocol
A structured string identifying the protocol to be used when attempting to connect to the messaging server. The supported protocols are represented by constants which are normally used but if required the string may be composed dynamically by the script. The string is made up of 2 parts, the first being the protocol identifier and the second a protocol option. The two parts are seperated by a colon (:) character. Acceptable values are described by the following table:
Protocol string | Constant | Usage |
---|---|---|
mqtt | SAM_MQTT | Use the MQTT (MQ Telemetry Transport) protocol connecting as a client to a server. |
wmq | SAM_WMQ | Use the IBM MQSeries protocol connecting as a client to a remote messaging server. This is equivalent to "wmq:client" (SAM_WMQ_CLIENT). At least a broker name (SAM_BROKER) must be specified in the options array. |
wmq:client | SAM_WMQ_CLIENT | Use the IBM MQSeries protocol connecting as a client to a remote messaging server. At least a broker name (SAM_BROKER) must be specified in the options array. |
wmq:bindings | SAM_WMQ_BINDINGS | Use the IBM MQSeries protocol connecting to a local messaging server and communicating via shared memory. At least a broker name (SAM_BROKER) must be specified in the options array. |
wpm | SAM_WPM | Use the IBM WebSphere Platform Messaging protocol to connect to the messaging infrastructure of a WebSphere Application server or cluster. A bus name must be specified in the options array (SAM_BUS) and endpoint and target chain may also be specified. |
rtt | SAM_RTT | Use the IBM Realtime transport protocol to connect to the messaging infrastructure. |
properties
An optional associative array of properties to describe the details of the connection required. The following table lists the available property names and accepted values:
Property name | default | Usage |
---|---|---|
SAM_BROKER | none |
The name of the broker or queue manager running on the messaging server.
This property must be set if using one of the variants of the WebSphere MQSeries protocol (SAM_WMQ, SAM_WMQ_CLIENT, SAM_WMQ_BINDINGS). |
SAM_HOST | localhost | The hostname of the machine on which the messaging server is running. |
SAM_PORT | 1414 for SAM_WMQ, 1506 for SAM_WPM, or 1883 for SAM_MQTT | The port number on which to attempt communication with the messaging server. |
SAM_EXPIRE_AFTER | 0 |
Time in milliseconds after which a message is deemed to have expired and can be
deleted from queues. The default value is 0 indicating the message never expires.
Warning: Not yet implemented! |
SAM_MESSAGE_PERSISTENCE | none |
Selects whether messages are made persistent during delivery. The value may be
SAM_PERSISTENT or SAM_NON_PERSISTENT. The default is dependant on the connection
type and capabilities of the Messaging Server to which the connection is made.
Warning: Not yet implemented! |
SAM_MQTT_CLEANSTART | FALSE | Optional connect option to indicate to an MQTT server that all previous connection data for this client should be removed and that subscriptions should be deleted when the client disconnects explicitly or unexpectedly. Setting the value to TRUE causes SAM to discard any subscription already in place for the client when it connects and also to discard subscription when the client disconnects. Setting the option to FALSE, or using the default, allows subscriptions to be durable and survive across client disconnects. |
SAM_PASSWORD | none | The password to be used when the Messaging Server to which the connection is being made requires authentication. |
SAM_TRANSACTIONS | SAM_AUTO | Indicates how transactions are handled on this connection. The value may be SAM_AUTO (the default) to allow automatic handling on a per operation basis or SAM_MANUAL to allow the PHP script to control the transaction boundaries. If SAM_MANUAL is used any in-flight transactions will be rolled back if the script is terminated or the connection is closed without a commit being executed. |
SAM_USERID | none | The user id to be used when the Messaging Server to which the connection is being made requires authentication. |
SAM_WPM_DUR_SUB_HOME | none | The name of the messaging engine where durable subscriptions are managed. (WPM ONLY). |