TongLinkQ message middleware use (c language)

       The message middleware is relatively simple to install and deploy. After decompressing it, copy the license and execute the tlq to start the service. The main related configuration and code are a bit circumscribed. The remote java or c link needs to be configured with a thin client.

/*Service start and stop*/
tlq -cstart
tlq -c stop

/*Create a queue control unit*/
tlqqcu TEST_QCU -a add QCUStatus[1]

/*Control unit creation queue-L (local queue)*/
tlqque TEST_QCU oneque -a add queueType[L]

/*Client compiling needs to add T_CLI parameter*/
cc -g -DT_CLI -o c_test -I/app/XXincl c_test.c -L/app/XXlib -lapi 

/*Custom properties use*/
char *properties;
Tlq_BeginProperties(&properties, enough length space);
Tlq_SetStringProperty(properties,"label","value");
Tlq_PutMsg(&gid,&qcuId,&uMsg,&uMsgOpt,properties,filename,&errstru );
Tlq_EndProperties(properties);

/*Get the property domain*/
Tlq_GetStringProperty(qcuId.appdesc_info.buf, length, "label", "value", sizeof("value"));

/*When there is a custom attribute to get the file name, you need to use the offset*/

Tlq_GetMsg(&gid,&qcuId,&uMsg,&uMsgOpt,&msgcontent,&errstru);
printf("filename = [%s]",msgcontent + uMsg.UserPropertyLen);

 

Guess you like

Origin blog.csdn.net/woailp___2005/article/details/84581200