Announcement Announcement Module
Collapse
No announcement yet.
jms:listener for OracleAQ Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jms:listener for OracleAQ

    Concerning the following configuration for OracleAQ in Spring

    PHP Code:
    <jms:listener-container connection-factory="connectionFactory"
        
    client-id="LUKAS34"
        
    message-converter="messageConverter"
        
    container-class="org.springframework.data.jdbc.jms.listener.oracle.AdtMessageListenerContainer"
        
    destination-type="topic">
        <
    jms:listener destination="AQ_TS_MY_TEST"  
            
    ref="messageDelegate" method="handleMessage" subscription="LUKAS34" />
    </
    jms:listener-container
    The problem here is that despite the fact that we don't have subscription LUKAS34 (but we have other - LUKAS) above configuration causes that all messages from AQ_TS_MY_TEST are read.

    I expect that if I define subscription="LUKAS" all messages for this subscription will be read and otherwise none will be read.

    What is the problem with above configuration?

    Additionally I see that that in table:
    PHP Code:
    select *
    from ALL_QUEUE_SUBSCRIBERS
    is many entries like 'TSUB_1_*' which seems to me that spring configuration 'creates' new consumers and name 'LUKAS' is skipped.
    Last edited by lukasz.rzeszotarski; Feb 19th, 2013, 10:03 AM.

  • #2
    Ok... I modified (it's not a solution but it shows where the problem is...) Let's take a look at private method ... org.springframework.jms.listener.DefaultMessageLis tenerContainer#initResourcesIfNecessary

    PHP Code:
        private void initResourcesIfNecessary() throws JMSException {
                if (
    getCacheLevel() <= CACHE_CONNECTION) {
                    
    updateRecoveryMarker();
                }
                else {
                    if (
    this.session == null && getCacheLevel() >= CACHE_SESSION) {
                        
    updateRecoveryMarker();
                        
    this.session createSession(getSharedConnection());
                    }
                    if (
    this.consumer == null && getCacheLevel() >= CACHE_CONSUMER) {
                        
    this.consumer createListenerConsumer(this.session);
                        
    synchronized (lifecycleMonitor) {
                            
    registeredWithDestination++;
                        }
                    }
                }
            } 
    if I change here (in this method consumer name from randomly generated (as I suppose randomly generated by spring) to my fixed name 'LUKAS' everything works as I expected - my listener reads only those messages which are defined in PL/SQL side for consumer 'LUKAS'.

    So the question is if I can somehow set up in spring jms:listener configuration consumer name.

    Comment


    • #3
      What change did you make to this method?

      The clientId gets set on the connection.

      I have a vague recollection that, for some vendors, the clientId has to be set on the connection factory (but it's only a vague recollection).

      Comment


      • #4
        I've changed only consumer name (direct modification on object property in debug mode in runtime). The problem is that when I create a new consumer I would like to have possibility to set up his name. Client-id property (from this part client-id="LUKAS34") is changing clientId of consumer object but not influence his name. Name of the consumer is always generated String like 'TSUB_1_*'. As I recognized also your current implementation for ADT payload

        PHP Code:
              return ((AQjmsSessionsession).createConsumer(destinationnull, new OraDataFactory(), nullfalse); 
        doesn't allow to create durable consumers (topic readers) even if you define it in spring like that
        destination-type="durableTopic" and subscription="LUKAS34".

        Finally I solved my problem by extending AdtMessageListenerContainer and overriding createConsumer method but anyway I think that spring support here (and description of parameters like destination-type, client-id, subscription when using oracleAQ with ADT payload when you need durable named consumer) is a bit confusing and not complete.

        Comment


        • #5
          Well, to be fair, Spring is coded to the JMS spec; the above code required you to cast the session to a proprietary object.

          Enough said, I think.

          Comment


          • #6
            Originally posted by Gary Russell View Post
            Well, to be fair, Spring is coded to the JMS spec; the above code required you to cast the session to a proprietary object.

            Enough said, I think.
            Above code is taken directly from spring implementation. See
            https://fisheye.springsource.org/cru/INT-CR-41


            And I am not sure if it is coded to the JMS spec in this part.

            Can you point me where
            http://download.oracle.com/otn-pub/j...7adb2af7e59e98

            Greetings,

            Lukasz

            Comment


            • #7
              Sorry - I didn't notice you were using spring-data-oracle; I am not familiar with that project. Of course, that uses Oracle extensions.

              Comment


              • #8
                I see it's actually part of the spring-data-jdbc project.

                http://www.springsource.org/spring-data/jdbc-extensions

                I suggest you ask your question on its forum...

                http://forum.springsource.org/forumdisplay.php?27-Data

                ..and/or if you think it's a bug, consider opening a JIRA issue for that project

                https://jira.springsource.org/browse/DATAJDBC

                or perhaps start by opening a discussion on GitHub... https://github.com/SpringSource/spri...dbc-ext/issues

                Comment


                • #9
                  Originally posted by Gary Russell View Post
                  I see it's actually part of the spring-data-jdbc project.

                  http://www.springsource.org/spring-data/jdbc-extensions

                  I suggest you ask your question on its forum...

                  http://forum.springsource.org/forumdisplay.php?27-Data

                  ..and/or if you think it's a bug, consider opening a JIRA issue for that project

                  https://jira.springsource.org/browse/DATAJDBC

                  or perhaps start by opening a discussion on GitHub... https://github.com/SpringSource/spri...dbc-ext/issues
                  Ok, great I will do that.

                  Thanks,

                  Lukasz

                  Comment

                  Working...
                  X