Spring JMS and Oracle AQ

后端 未结 3 938
遇见更好的自我
遇见更好的自我 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 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

提交回复
热议问题