Este conteúdo não está disponível no idioma selecionado.
11.7. Setting Connection Options
There are two different ways to set connection options. The first is to do it in the Connection constructor:
- Python
connection = Connection("localhost:5672", reconnect = True, reconnect_urls = "amqp:tcp:127.0.0.1:5674", heartbeat = 1) try: connection.open()
connection = Connection("localhost:5672", reconnect = True, reconnect_urls = "amqp:tcp:127.0.0.1:5674", heartbeat = 1) try: connection.open()
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - C++
Connection connection("localhost:5672", "{reconnect: true, reconnect_urls:'amqp:tcp:127.0.0.1:5674', reconnect:true, heartbeat: 1}"); try { connection.open();
Connection connection("localhost:5672", "{reconnect: true, reconnect_urls:'amqp:tcp:127.0.0.1:5674', reconnect:true, heartbeat: 1}"); try { connection.open();
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - .NET/C#
Connection connection= new Connection("localhost:5672", "{reconnect: true, reconnect_urls:'amqp:tcp:127.0.0.1:5674', reconnect:true, heartbeat: 1}"); try { connection.Open();
Connection connection= new Connection("localhost:5672", "{reconnect: true, reconnect_urls:'amqp:tcp:127.0.0.1:5674', reconnect:true, heartbeat: 1}"); try { connection.Open();
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The second approach is to do it through the Connection properties:
- Python
connection = Connection("localhost:5672") connection.reconnect = True try: connection.Open()
connection = Connection("localhost:5672") connection.reconnect = True try: connection.Open()
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - C++
Connection connection("localhost:5672"); connection.setOption("reconnect", true); try { connection.open();
Connection connection("localhost:5672"); connection.setOption("reconnect", true); try { connection.open();
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - .NET/C#
Connection connection = new Connection("localhost:5672"); connection.SetOption("reconnect", true); try { connection.Open();
Connection connection = new Connection("localhost:5672"); connection.SetOption("reconnect", true); try { connection.Open();
Copy to Clipboard Copied! Toggle word wrap Toggle overflow