This discussion is archived
11 Replies Latest reply: Sep 11, 2012 7:07 AM by Tarak RSS

Message not deleting from Topic after successfully dequeue

Tarak Newbie
Currently Being Moderated
Hi All,

Help please..

I need to design a process where message have to produce into a AQ JMS topic and later i have to consume the message from the same topic and publish to a Queue.

In order to move on this i have created a sample My_Topic1 and My_Queue1 with below syntax

Topic:-

EXEC dbms_aqadm.create_queue_table (queue_table=>'MY_Topic1', queue_payload_type=>'sys.aq$_jms_text_message', multiple_consumers=>true );
EXEC dbms_aqadm.create_queue(queue_name=>'MY_Topic1', queue_table=>'MY_Topic1');
EXEC dbms_aqadm.start_queue(queue_name=>'MY_Topic1');

Queue:-

EXEC dbms_aqadm.create_queue_table (queue_table=>'My_Queue1', queue_payload_type=>'sys.aq$_jms_text_message', multiple_consumers=>false);
EXEC dbms_aqadm.create_queue(queue_name=>'My_Queue1', queue_table=>'My_Queue1');
EXEC dbms_aqadm.start_queue(queue_name=>'My_Queue1');

Now i created Foreign server and create local and destination topic of queue.topics name and also created Data source of XAType.

Now my bpel process getting a message(which as one element of sting type) from a web service and i am producing the same message to Topic. Once the message published to topic in a separate composite my JMS Adaptor dequeue/Consume the message from the topic and subscribe it to queue.

The Above scenario working as expected but here what my observation on this

1)When i dequeue message from a topic using bpel process successfully i am able to subscribe the message to queue but the message still remain in the topic i think it suppose to get of the topic once successfully dequeued.

Even i check the subscriber topic table and one subscriber is listening to the topic.

2)If in case any error generated at the time of subscribing to the queue the message should rollback( because i am using XA Transaction) but i think it is not happening as i can see in my topic view aq$my_topic1 MGS_STATE changed to PROCESSED.

Can some one please let me know where i am going wrong.

Thanks in advance.

Regards,
Tarak.

Edited by: Tarak on Sep 9, 2012 8:47 PM
  • 1. Re: Message not deleting from Topic after successfully dequeue
    Tarak Newbie
    Currently Being Moderated
    Can some please help me here.

    Regards,
    Tarak.

    Edited by: Tarak on Sep 9, 2012 8:46 PM
  • 2. Re: Message not deleting from Topic after successfully dequeue
    Tarak Newbie
    Currently Being Moderated
    Request some one please update on this.

    Regards,
    Tarak.
  • 3. Re: Message not deleting from Topic after successfully dequeue
    vladodias Guru
    Currently Being Moderated
    the message still remain in the topic
    Is your process consuming the same message twice, if you restart the server or something like that?
    How many subscribers does the topic have? The message may be just there waiting for the next subscriber to pick it up...
    Are you using durable subscribers?

    Cheers,
    Vlad
  • 4. Re: Message not deleting from Topic after successfully dequeue
    Tarak Newbie
    Currently Being Moderated
    Hi Vald,

    Thanks for the response from your side.
    Is your process consuming the same message twice, if you restart the server or something like that?
    No, I don't see this behaviour, just now i restarted the server and the old message are in topic and no new instances got generated...
    How many subscribers does the topic have? The message may be just there waiting for the next subscriber to pick it up...
    Topic is using one subscribe and this one i can see the particular subscriber listening to the in topic view table aq$my_topic1_s
    Are you using durable subscribers?
    Yes i am using durable subscribers

    Regards,
    Tarak.

    Edited by: Tarak on Sep 9, 2012 9:56 PM

    Edited by: Tarak on Sep 9, 2012 9:57 PM
  • 5. Re: Message not deleting from Topic after successfully dequeue
    Tarak Newbie
    Currently Being Moderated
    Hi Vald,

    I need you valuable thoughts in understanding the behavior of Topic/Queue.

    Now i am able to resolved the issue. It is problem with the subscribers listening to the same topic.

    Some confusion started in my mind while creating topics. Below two case i tested and got some doubts. Kindly help me on this.

    1) Created a topic and subscriber as per below code so that i can en queue a message in to the topic. I feel subscriber should be there to enqueu message into topic else any message publish to the topic will not go.When i created Dequeue process to the same topic and deployed the process and i observed a new subscriber is created(SOA provide name or durable one provided in adaptor) in the subscriber table of the topic.
    DECLARE
      aSubscriber sys.aq$_agent;
    BEGIN 
      aSubscriber := sys.aq$_agent('subscribername',
                                  '',
                                  0);
      dbms_aqadm.add_subscriber
         ( queue_name     => 'schemaname.topicname/queuename'
          ,subscriber     => aSubscriber);
    END;
    /
    Doubt1:- how to create a dummy subscriber so that i can en queue the message in the topic.
    Doubt2:- Do i need to avoid creating subscriber after creating topic if in case i am De queuing the topic?

    2) Created topic without subscriber and create dequeue process and given durable subscriber.Message successfully removed from the topic after dequeue.

    issue:- in case of error in the process how to roll back the message back to queue. I am using XA transaction in this case.

    Dequeue--Bpel1--Equeue

    If message fails in Bpel is it possible to rollback the message into the topic? Or new transaction creates after de-queue the message.

    i am thankful for your valuable input on this.

    Regards,
    Tarak.
  • 6. Re: Message not deleting from Topic after successfully dequeue
    vladodias Guru
    Currently Being Moderated
    Tarak wrote:
    I need you valuable thoughts in understanding the behavior of Topic/Queue.
    Not sure how valuable my thoughts are, as you rarely give me points for them, but let's try again...
    Now i am able to resolved the issue. It is problem with the subscribers listening to the same topic.
    So, I presume that there were another subscriber to pick up the message... As I said before...
    Some confusion started in my mind while creating topics. Below two case i tested and got some doubts. Kindly help me on this.
    Topics are not like queues, you can enqueue and dequeue from a queue, a topic is for publish and subscribe... If a process tries to publish a message on a topic with no subscribers, the message won't get published, and no exception will be raised, that's why there are durable subscribers, so you can guarantee there are a subscriber there when you are publishing...
    If message fails in Bpel is it possible to rollback the message into the topic?
    Should be... If you there is a transaction long enough to encompass the message subscription from the topic and the enqueue on the other queue and something fail in between, the message should remain available for the durable subscriptor to retry...

    Cheers,
    Vlad
  • 7. Re: Message not deleting from Topic after successfully dequeue
    Tarak Newbie
    Currently Being Moderated
    Hi Vald,
    Topics are not like queues, you can enqueue and dequeue from a queue, a topic is for publish and subscribe
    ... If a process tries to publish a message on a topic with no subscribers, the message won't get published, and no exception will be raised, oi
    that's why there are durable subscribers, so you can guarantee there are a subscriber there when you are publishing...
    Now i got doubt on this... so when i am publishing message on topic, the topic should have subscriber....In future if i want to subscriber/consume message from topic do i need to create durable subscriber, if yes then how to avoid former subscriber listening on to the topic?
    Should be... If you there is a transaction long enough to encompass the message subscription from the topic and the enqueue on the other queue and something fail in between, the message should remain available for the durable subscriptor to retry...
    i generated binding fault when en-queuing message on queue by changing queue jndi name... now the message flushed out of the topic but it suppose to be rollback to Topic..when i see instance of de-queue process it tried for 11 time by invoking the queue...My doubt is why it is tried for 11 times... no where i specified retire mechanism for 11 times... is't expected behavior in queue?

    Message not coming back to the topic.... do i need to explicitly specify any property to rollback the message to topic even if i use XA transaction?

    Regards,
    Tarak.
  • 8. Re: Message not deleting from Topic after successfully dequeue
    vladodias Guru
    Currently Being Moderated
    Tarak wrote:
    In future if i want to subscriber/consume message from topic do i need to create durable subscriber
    Yes, if you want messages published to be persisted even when the subscriber is offline...
    how to avoid former subscriber listening on to the topic?
    In plain JMS you "unsubscribe"... There's a unsubscribe method on the TopicSession interface... Not sure how to do it in Oracle AQ, but to have an extra subscriber shouldn't be an issue by itself...
    Message not coming back to the topic....
    I think it actually is coming back, as it is retrying... What is your max_retries configuration on the topic? There is a max_retries and a retry_delay configuration in Oracle AQ...
    There should also be a configuration on what to do when the message expires... If it will move to an error queue or just delete the message...

    Hope this helps...

    Cheers,
    Vlad
  • 9. Re: Message not deleting from Topic after successfully dequeue
    Tarak Newbie
    Currently Being Moderated
    Hi Vald.
    I think it actually is coming back, as it is retrying... What is your max_retries configuration on the topic? There is a max_retries and a retry_delay configuration in Oracle AQ...
    There should also be a configuration on what to do when the message expires... If it will move to an error queue or just delete the message...
    No the error is not moving Error. Error not created yet for the topic i am using. I think error table will automatic back on the expire data or retry count.

    Just i check in all _queues table and for my queue(which i am using to enqueue the message ) the max retire is 5. I think it is by default will set it as 5 if i am not specifying it at the time of queue creation.

    Now what i what to know is why the retry is working every time when server restarts also can we send back the message to same topic if in case message not publish into the queue after successful retry ?

    i read it as If a dequeue transaction fails because the server process dies (including ALTER SYSTEM KILL SESSION) or SHUTDOWN ABORT on the instance, then RETRY_COUNT is not incremented. How to specify ALTER SYSTEM KILL SESSION or SHUTDOWN ABORT in order avoid increment.

    Please let me know...
  • 10. Re: Message not deleting from Topic after successfully dequeue
    vladodias Guru
    Currently Being Moderated
    can we send back the message to same topic if in case message not publish into the queue after successful retry ?
    The behavior should be the process consume a message from the topic and will try to do its job. If this process fail, the message will remain in the topic, to be eventually consumed again later... After the max number of retries reached the message is marked as failed or expired and will not be delivered to the consumer anymore... What to do with a failed/expired message is usually configurable, but doesn't make sense to place it in the same topic again... If the messages are failing too quickly better to adjust the max_retries and retry_delay...
    why the retry is working every time when server restarts
    What do you mean? What server was restarted, the database or the soa server? Messages that still didn't reach the max retry number will still be retried...
    If a dequeue transaction fails because the server process dies
    I think it is talking about the database server here...

    Cheers,
    Vlad
  • 11. Re: Message not deleting from Topic after successfully dequeue
    Tarak Newbie
    Currently Being Moderated
    The behavior should be the process consume a message from the topic and will try to do its job. If this process fail, {code]
    
    But in this message not there in topic even it is failed in soa process.....i am very much interested how this XA is  working that the reason i am trying all this.
    What to do with a failed/expired message is usually configurable, but doesn't make sense to place it in the same topic again... If the messages are failing too quickly better to adjust the max_retries and retry_delay...
    I agress in real senario we will move to error queue. But in that case also some how we need to read the message from queue and publish to the end system.
    I am just trying to understand the behavior and what i came to know is after all the retire fails message not going to topictable _E. But when i pass Expire time property or time to live then it is moving to error table.
    What do you mean? What server was restarted, the database or the soa server? Messages that still didn't reach the max retry number will still be retried...
    Wheni am bouncing my managed server soa_server1 i can see the invoke activity is trying to publish the message into queue... this is happens after server restart and suppose not to happen....
    
    
    But thanks alot for the inputs...
    
    Regards,
    Tarak.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points