Интеграция приложений на основе WebSphere MQ


Example.9.2


/* Листинг программы transmit */

#include

#include

#include

#include

#include

#include

char queue_input[48] = "";

char queue_output[48] = "";

char queue_reply[48] = "";

char reply_time[48] = "";

char buf[48];

time_t tmr;

int queuenamelen;

FILE *fptr;

int main(int argc, char **argv)

{

MQOD odG = {MQOD_DEFAULT};

MQOD odP = {MQOD_DEFAULT};

MQOD odR = {MQOD_DEFAULT};

MQOD odI = {MQOD_DEFAULT};

MQMD md = {MQMD_DEFAULT};

MQBO mbo = {MQBO_DEFAULT};

MQGMO gmo = {MQGMO_DEFAULT};

MQPMO pmo = {MQPMO_DEFAULT};

MQCHAR48 QManager;

MQHCONN Hcon;

MQHOBJ Hobj;

MQHOBJ Hout;

MQHOBJ Hrep;

MQLONG O_options;

MQLONG C_options;

MQLONG CompCode;

MQLONG Reason;

MQLONG CReason;

MQBYTE buffer[8001];

MQLONG buflen;

MQLONG replylen;

MQLONG messlen;

static MQBYTE24 LastMsgId;

if ( (fptr=fopen ("transmit.ini","r" )) == NULL )

{printf("Cannot open transmit.ini file" );

exit(1);

}

else{

fgets(queue_input, 48, fptr);

queuenamelen = strlen(queue_input) - 1;

queue_input[queuenamelen] = ' ';

strcpy(odG.ObjectName, queue_input);

fgets(queue_output, 48, fptr);

queuenamelen = strlen(queue_output) - 1;

queue_output[queuenamelen] = ' ';

strcpy(odP.ObjectName, queue_output);

fgets(queue_reply, 48, fptr);

queuenamelen = strlen(queue_reply) - 1;

queue_reply[queuenamelen] = ' ';

strcpy(odR.ObjectName, queue_reply);

fgets(reply_time, 48, fptr);

queuenamelen = strlen(reply_time) - 1;

reply_time[queuenamelen] = ' ';

fclose (fptr);

}

strcpy(QManager, ""); /* Работаем с менеджером очередей по умолчанию */

MQCONN(QManager, &Hcon, &CompCode, &CReason);

if (CompCode == MQCC_FAILED)

{

printf("MQCONN to %s ended with reason code %ld\n", QManager, CReason);

exit(CReason);

}

O_options = MQOO_BROWSE + MQOO_INPUT_SHARED ;

MQOPEN(Hcon, &odG, O_options, &Hobj, &CompCode, &Reason);

if (Reason != MQRC_NONE) { printf("MQOPEN %s ended with reason code %ld\n", queue_input, Reason); }




Начало  Назад  Вперед



Книжный магазин