CreateChannel Method
Creates a new channel.
Syntax
ANSI (Cross Platform) int CreateChannel(const char* lpszChannelName); Unicode (Windows) INT CreateChannel(LPCWSTR lpszChannelName);
- (void)createChannel:(NSString*)channelName;
#define MID_AMQPCLASSIC_CREATECHANNEL 9 IPWORKSIOT_EXTERNAL int IPWORKSIOT_CALL IPWorksIoT_AMQPClassic_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);
Remarks
This method creates a new channel with the name ChannelName and adds it to the Channel* properties. If a channel with the given ChannelName already exists, an error will be thrown.
Connecting and Creating a Channel
// The examples in this documentation use a RabbitMQ server, which requires SASL Plain auth.
amqpc1.AuthScheme = AmqpclassicAuthSchemes.smSASLPlain;
amqpc1.User = "guest";
amqpc1.Password = "guest";
amqpc1.SSLEnabled = true;
amqpc1.Connect("amqpclassic.test-server.com", 5671);
amqpc1.CreateChannel("channel");
Error Handling (C++)
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)