--- parser3/src/classes/amqp.C 2026/09/20 11:22:08 1.22 +++ parser3/src/classes/amqp.C 2026/10/08 18:56:00 1.26 @@ -5,19 +5,15 @@ Authors: Konstantin Morshnev */ + +#include "classes.h" #include "pa_vmethod_frame.h" +#include "pa_vamqp.h" #include "pa_request.h" -#include "pa_int.h" -#include "pa_vstring.h" -#include "pa_vhash.h" #include "pa_varray.h" #include "pa_vbool.h" -#include "pa_vvoid.h" -#include "pa_vdouble.h" -#include "pa_vamqp.h" #include "pa_os.h" -#include "pa_globals.h" #ifdef WITH_AMQP @@ -25,17 +21,13 @@ #include #include -#ifndef WITHOUT_AMQP_SSL +#ifdef WITH_AMQP_SSL #include #endif -#ifdef _MSC_VER -#pragma comment(lib, "rabbitmq.4.lib") -#endif - #endif -volatile const char * IDENT_AMQP_C="$Id: amqp.C,v 1.22 2026/09/20 11:22:08 moko Exp $" IDENT_PA_VAMQP_H; +volatile const char * IDENT_AMQP_C="$Id: amqp.C,v 1.26 2026/10/08 18:56:00 moko Exp $" IDENT_PA_VAMQP_H; class MAmqp: public Methoded { public: // VStateless_class @@ -106,7 +98,7 @@ static void amqp_connect(VAmqp& self, Re int heartbeat_sec = 30; int reconnect_interval_sec = 0; bool tls_specified = false; -#ifndef WITHOUT_AMQP_SSL +#ifdef WITH_AMQP_SSL const char* tls_ca = 0; const char* tls_cert = 0; const char* tls_key = 0; @@ -134,7 +126,7 @@ static void amqp_connect(VAmqp& self, Re } else if(key=="auto_reconnect"){ reconnect_interval_sec=r.process(*value).as_int(); } else if(key=="tls"){ -#ifndef WITHOUT_AMQP_SSL +#ifdef WITH_AMQP_SSL tls_specified = true; if(HashStringValue* tls_options=value->get_hash()){ for(HashStringValue::Iterator t(*tls_options); t; t.next()){ @@ -163,7 +155,7 @@ static void amqp_connect(VAmqp& self, Re amqp_connection_state_t conn = amqp_new_connection(); amqp_socket_t* socket = 0; -#ifndef WITHOUT_AMQP_SSL +#ifdef WITH_AMQP_SSL if(tls_specified) { socket = amqp_ssl_socket_new(conn); if(!socket) @@ -202,7 +194,7 @@ static void amqp_connect(VAmqp& self, Re check(self, rlogin, "login "); } - int channel = 1; + amqp_channel_t channel = 1; amqp_channel_open(conn, channel); amqp_rpc_reply_t ropen = amqp_get_rpc_reply(conn); if(ropen.reply_type != AMQP_RESPONSE_NORMAL){ @@ -787,7 +779,7 @@ static struct timeval* amqp_wait_tv(stru // message (if any) is still coming // - anything else: a genuine channel/connection close (typically after a protocol violation) - build a // reply so check() can classify it correctly (cheap channel repair vs full reconnect) -static amqp_rpc_reply_t amqp_consume_message_checked(amqp_connection_state_t conn, int channel, amqp_envelope_t* envelope, struct timeval* tv) { +static amqp_rpc_reply_t amqp_consume_message_checked(amqp_connection_state_t conn, amqp_channel_t channel, amqp_envelope_t* envelope, struct timeval* tv) { for(;;) { amqp_rpc_reply_t res = amqp_consume_message(conn, envelope, tv, 0); if(res.reply_type != AMQP_RESPONSE_LIBRARY_EXCEPTION || res.library_error != AMQP_STATUS_UNEXPECTED_STATE)