Spring JMS and Oracle AQ

后端 未结 3 940
遇见更好的自我
遇见更好的自我 2021-01-19 14:31

Has anyone got Spring JMS to work with an Oracle AQ queue?

I am trying to connect to AQ based on this article http://blog.nominet.org.uk/tech/2007/10/04/spring-jms-w

相关标签:
3条回答
  • 2021-01-19 14:57

    That error indicates to me it's actually working but you're not giving it a payload factory to create the object coming off the queue. You do that when you create the receiver. In this case my payload is XMLTYPE so I just use its payload factory:

    queueReceiver = ((AQjmsSession) queueSession).
       createReceiver(queue, XMLType.getORADataFactory());
    
    0 讨论(0)
  • 2021-01-19 15:03

    This is how you can solve it if you are using Spring: http://blog.javaforge.net/post/30858904340/oracle-advanced-queuing-spring-custom-types

    In a "springless" environment just create your own message consumer like described in the blog post above.

    0 讨论(0)
  • 2021-01-19 15:10

    You have to supply a JDBC type map when you want to en-queue or de-queue AnyDataType or User Defined Payloads.

    The best place to do it, in the Link you have posted will be in OracleAqDestinationFactoryBean.getObject.

    In my case, I wanted to de-queue Oracle LCRs which are of XMLType , so I had to do the following in the getObject

    public Object getObject() throws Exception {
        QueueConnection queueConnection = connectionFactory.createQueueConnection();
        AQjmsSession session = (AQjmsSession) queueConnection.createQueueSession(true,
                Session.SESSION_TRANSACTED);
        Map map = session.getTypeMap();
        map.put("SYS.XMLTYPE", Class.forName("oracle.xdb.XMLTypeFactory"));
        return session.getQueue(queueUser, queueName);
    }
    

    Remember for AnyDataType Payload you have to use OCI JDBC driver, as the thin driver won't do.

    More info on custom payload here http://download.oracle.com/docs/cd/B19306_01/server.102/b14257/aq_stage.htm#sthref2705

    0 讨论(0)
提交回复
热议问题