AMQP メッセージのパブリッシュ(2 / 3)

· コンポーネント

PublishMessages メソッドは AMQP サーバーへメッセージを送信するために使用します。

AMQP サーバーはキュー名をルーティングキーとして使用し、キューを「direct」エクスチェンジに自動的にバインドします。これにより、バインディングを宣言する必要なく特定のキューへメッセージを送信できます(PublishMessage メソッドを呼び出して、Exchange 引数を空、RoutingKey 引数にキュー名を渡すだけです)。

メッセージのパブリッシュ

The method has the following arguments:

AMQP.PublishMessage('channel_name', 'exchange_name', 'routing_key', 'Hello from sgcWebSockets!!!');
procedure OnAMQPBasicReturn(Sender: TObject; const aChannel: string; const aReturn: TsgcAMQPFramePayload_Method_BasicReturn; const aContent: TsgcAMQPMessageContent);
begin
  DoLog('#AMQP_basic_return: ' + aChannel + ' ' + IntToStr(aReturn.ReplyCode) + ' ' + aReturn.ReplyText + ' ' + aContent.Body.AsString);
end;