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()
Copy to Clipboard Toggle word wrap
C++
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 Toggle word wrap
.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();
Copy to Clipboard Toggle word wrap
The second approach is to do it through the Connection properties:
Python
connection = Connection("localhost:5672")
connection.reconnect = True
try:
  connection.Open()
Copy to Clipboard Toggle word wrap
C++
Connection connection("localhost:5672");
connection.setOption("reconnect", true);
try {
    connection.open();
Copy to Clipboard Toggle word wrap
.NET/C#
Connection connection = new Connection("localhost:5672");
connection.SetOption("reconnect", true);
try {
    connection.Open();
Copy to Clipboard Toggle word wrap
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat