0 Replies Latest reply: Aug 7, 2012 11:58 AM by 673780 RSS

    Migrate OraData Payload to 11g

    673780
      We've been using a custom data type as payload for an Oracle advance queue since version 9i. Now we're trying to transition to 11g and I'm coming up with problems using the new API. In the old API, I would enqueue a message as follows:

           MY_OBJECT_TY myObj = new MY_OBJECT_TY();
           myObj.setName("MY name");
           oracle.AQ.AQMessage message = aQQueue.createMessage();
           oracle.AQ.AQObjectPayload payload = message.getObjectPayload();
           payload.setPayloadData(myObj);
           oracle.AQ.AQMessageProperty msgProps = message.getMessageProperty();
           msgProps.setCorrelation("My correlation");
           oracle.AQ.AQEnqueueOption enqOption = new AQEnqueueOption();
           aQQueue.enqueue(enqOption, message);

      where MY_OBJECT_TY is a Java class that implements the ORAData and ORADataFactory interface and the Oracle type is described as follows:

      SQL> desc my_object_ty;
      Name Null? Type
      ----------------------------------------- -------- ----------------------------
      NAME VARCHAR2(32)
      BUF VARCHAR2(4000)
      LARGE_BUF CLOB


      In the new API, I believe I'm supposed to use OracleConnection.enqueue() to enqueue my message, but my problem is constructing the object payload. Could someone provide pointers or code snippets to help accomplish my goal?