5 Replies Latest reply: Apr 16, 2014 7:45 AM by BrunnoAttorre RSS

    OTMQ SAF dequeue- Duplicated message?

    BrunnoAttorre

      Hi Tuxedo Team,

       

      Currently we are experiencing a strange behavior on the OTMQ product. The situation is as follows:

       

      1- We enqueue a WF-SAF message to a OTMQ queue.

      2- We dequeue this message and make the confirmation (no error at this point).

      3- The message still remains on the _DQF_ queue.

      4- After while, the message is resent to the OTMQ Queue (with the duplicated ctl field set) and, with the same client as before, we confirm it again.

      5- This time, the message is removed from the _DQF_ and it's not redelivered.

       

      I don't know if I'm missing something and this is a expected behavior or if there's some configuration needed. On my view, once we confirm the SAF message it shouldn't be delivered.

       

       

      Can anyone help me?

       

      Thanks,

      Brunno Attorre

        • 1. Re: OTMQ SAF dequeue- Duplicated message?
          right lv

          hi, Brunno Attorre,

            Does the client spend a lot of time before the first confirm and after the deque call?  Does the client detach from the queue?

          Can you share the program and the ubb file?


          The TuxMQFWD is responsilbe for forword the message from DQF to the destination queue? about the TuxMQFWD please see

          http://docs.oracle.com/cd/E35855_01/otmq/docs12c/ref/ubb.html#wp1113637


          TuxMQFWD

          SRVGRP="identifier"

          SRVID="number" CLOPT=" [-A][servopts options] -- [-f delay time][-t timeout][-i idle time]"

           

          right.lv

          • 2. Re: OTMQ SAF dequeue- Duplicated message?
            BrunnoAttorre

            Hey,

             

            Sure I can share them... It's quite a simple one really:

            This is the main method:

             

            int main(int argc, char **argv)

            {

                int ret;

                char qspacename[16];

                char qname[128];

                char q_space[16];

                char q_name[128];

                TPQCTL ctl;

                Q_ATTACH_CTL qattachctl;

                long flags;

                char *reqstr; /* string to be sent */

                long len; /* length of return string */

                int ch;

                int32 arg_list = TMQ_NOFLUSH_Q;

                int32 arg_count = 1;

                int32 purge_count;

             

                if (argc < 5)

                {

                    printf("Usage: deqclt -g <qspace> -q <qname>\n");

                    return 0;

                }

                strcpy(qspacename, "QSPACE");

                strcpy(qname, "QUEUE2");

             

                while ((ch = getopt(argc, argv, "g:q:")) != EOF)

                {

                    switch (ch)

                    {

                        case 'g':

                            strcpy(qspacename, optarg);

                            break;

                        case 'q':

                            strcpy(qname, optarg);

                            break;

                        default:

                            printf("Usage: deqclt -g <qspace> -q <qname>\n");

                            return 0;

             

                    }

             

                }

             

             

                if (tpinit(NULL) == -1)

                {

                    (void) fprintf(stderr, "failed to join application: %s\n", tpstrerror(

                            tperrno));

                    exit(1);

                }

             

                memset(&qattachctl, 0x0, sizeof(qattachctl));

                qattachctl.attachmode = TMQ_ATTACH_BY_NAME;

                qattachctl.qtype = TMQ_ATTACH_PQ;

                qattachctl.namespace_list = NULL;

                qattachctl.namespace_list_len = 0;

                qattachctl.timeout = 30;

             

                memset(&ctl, 0x0, sizeof(ctl));

                ctl.flags |= OTMQ;

                flags=0;

                strcpy(q_space, qspacename);

                strcpy(q_name, qname);

                if (tpqattach(q_space, q_name, &ctl, &qattachctl, flags) == -1)

                {

                    (void) fprintf(stderr, "failed to attach q[%s.%s]: %s\n", q_space,

                            q_name, tpstrerror(tperrno));

                    (void) tpterm();

                    exit(1);

                }

             

                len = 100;

             

                if ((reqstr = tpalloc("STRING", NULL, len)) == NULL)

                {

                    (void) fprintf(stderr, "unable to allocate STRING buffer: %s",

                            tpstrerror(tperrno));

                    (void) tpterm();

                    exit(1);

                }

             

                /* dequeue the message from the queue */

                ctl.timeout = 30;

             

             

                    if (tpdeqplus(qspacename, qname, &ctl, &reqstr, &len, 0) == -1)

                {

                    if (tperrno == TPEDIAGNOSTIC)

                    {

                        print_diagnostic(ctl.diagnostic);

                    } else

                    {

                        (void) fprintf(stderr, "Failure to dequeue  %s\n", tpstrerror(

                                tperrno));

                    }

                    tpfree((char *) reqstr);

                    (void) tpterm();

                    exit(1);

                }

             

                printf("Dequed message class=[%d],type=[%d],receipt_msg_type=%d\n",

                        ctl.msg_class, ctl.msg_type, ctl.receipt_msg_type);

             

                if ((ctl.status_block.del_psb_status == OTMQ__MSGUNDEL)

                        && (ctl.receipt_msg_type > 0))

                {

                    printf("\nIt is UMA message:\n[%s],len=[%d]\n", reqstr, len);

                } else

                {

                    if (ctl.msg_type == MSG_TYPE_MRS_ACK)

                    {

                        printf("It is an ACK message\n");

                    } else

                    {

                        printf("The message dequed is:\n[%s],len=[%d]\n", reqstr, len);

                    }

                }

             

             

             

             

                /*========================================Confirmation Needed==============================================*/

               

             

             

             

                if(ctl.status_block.del_psb_status == OTMQ__POSSDUPL )

                {

                    printf("\nDuplicated Message \n");

                    if(tpqconfirmmsg(ctl.seq_number, 0) < 0)

                    {

                        if (tperrno == TPEDIAGNOSTIC)

                        {

                            print_diagnostic(ctl.diagnostic);

                        } else

                        {

                            (void) fprintf(stderr, "Failure to confirmmsg  %s.\n", tpstrerror(

                                tperrno));

                        }

                        tpfree((char *) reqstr);

                        (void) tpterm();

                        exit(1);

                    }

                }else if( ctl.status_block.del_psb_status == OTMQ__CONFIRMREQ) /* check the message delivery status stored in TPQCTL */

                {

                     /* This is a message need to be confirmed explicitly,

             

                     * use the dequeued message sequence to confirm */

               

                     printf("\n This is a message need to be confirmed explicitly \n");

                     if(tpqconfirmmsg(ctl.seq_number, 0) < 0)

             

                       {

             

                           /* print out the error message string or diagnostic code */

             

                           tpfree((char *) reqstr);

             

                           (void) tpterm();

             

                           exit(1);

             

                     }

             

            }

             

                /*========================================Confirmation Needed==============================================*/

             

             

                /* detach from queue server */

                if (tpqdetach(qspacename, qname, &arg_list, arg_count, &purge_count, 0)

                        == -1)

                {

                    (void) fprintf(stderr, "Failure to detach: %s\n", tpstrerror(tperrno));

                    if (tperrno == TPEDIAGNOSTIC)

                    {

                        print_diagnostic(ctl.diagnostic);

                    }

                    tpfree((char *) reqstr);

                    (void) tpterm();

                    exit(1);

                }

             

                (void) tpqexit();

                (void) tpterm();

                return (0);

            }

             

             

            And this is our UBB Server Section:

            DEFAULT:

                              CLOPT="-A"

            TuxMsgQ

                        SRVGRP = QG  SRVID = 1

                        RESTART = Y CONV = N MAXGEN=10

                        CLOPT = "-s 2:TuxMsgQ --  "

             

            TuxMsgQLD

                                    SRVGRP=QG  SRVID=15

                                    RESTART=Y CONV=N MAXGEN=10

                                    CLOPT=" --  -g 2 -l  //192.168.80.114:10080 -f group.init"

             

            TuxMQFWD

                    SRVGRP=QG  SRVID=3

                    REPLYQ=N

             

             

            *SERVICES

            • 3. Re: OTMQ SAF dequeue- Duplicated message?
              BrunnoAttorre

              Hi, Can anyone help me on this?

              • 4. Re: OTMQ SAF dequeue- Duplicated message?
                right lv

                hi,

                Sorry for not see your reply.

                I need some time to have investigation. I will reply to you later. Sorry for inconvenience.

                • 5. Re: OTMQ SAF dequeue- Duplicated message?
                  BrunnoAttorre

                  Hi, I believe it has something to do with the fact that the destination Queue was created with a Retry number greater than 0.

                   

                  If I create de SAF Destination Queue with Retry count = 0, the Duplicated message does not occur (it is redelivered through the Offline Message Driver).

                   

                  So, when I'm planning on using SAF, do I always set the retry count of the Queue to 0?