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


Программа rewriter (модель "один к одному") - часть 2


/* Листинг программы rewriter */ /**********************************************************************/ /* Program name: Rewriter */ /* Description: Rewriter C program pass messages to output queue */ /* Function: */ /* Rewriter is a sample C program to demonstrate the main MQI calls; */ /* each message is copied from the input queue to the output */ /* queue, and sends a report to the log file */ /**********************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <signal.h> #include <io.h> /* includes for MQI */ #include <cmqc.h> char queue1[48] = ""; char queue2[48] = ""; char logfilename[48] = ""; char logfilename2[48] = ""; char buf[48]; int queuenamelen; time_t tmr; FILE * fp; FILE *fptr;

void cntrl_c_handler(int sig);

/* Declare MQI structures needed */ MQOD odG = {MQOD_DEFAULT}; /* Object Descriptor for GET */ MQOD odP = {MQOD_DEFAULT}; /* Object Descriptor for PUT */ MQOD odI = {MQOD_DEFAULT}; /* Object Descriptor for InitQ */ MQOD odR = {MQOD_DEFAULT}; /* Object Descriptor for report */ MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */ MQGMO gmo = {MQGMO_DEFAULT}; /* get message options */ MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */ MQTMC2 *trig; /* trigger message structure */ MQCHAR48 QManager; /* queue manager name */ MQHCONN Hcon; /* connection handle */ MQHOBJ Hobj; /* object handle, server queue */ MQHOBJ Hinq; /* handle for MQINQ */ MQHOBJ Hout; /* handle for MQPUT */ MQLONG O_options; /* MQOPEN options */ MQLONG C_options; /* MQCLOSE options */ MQLONG CompCode; /* completion code */ MQLONG Reason; /* reason code */ MQLONG CReason; /* reason code (MQCONN) */ MQBYTE buffer[8001]; /* message buffer */ MQLONG buflen; /* buffer length */ MQLONG messlen; /* message length received */ MQLONG Select[1]; /* attribute selectors */ MQLONG SelectValue[1]; /* value attribute selectors */ MQLONG char_count;




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



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