Enqueue AQ$_JMS_OBJECT_MESSAGE via PLSQL to JMS and Dequeue via Bean

Hi,
I want to be able to enqueue on to AQ$_JMS_OBJECT_MESSAGE queue and the dequeue to via Java Bean.
Unfortunately I am having problems dequeuing via the messege driven bean as it is not able to dequeue any of the messages enqueued via oracle SQL plus
I am able to enqueue and dequeue via the bean. I am also able to enqueue and dequeue via oracle SQL plus and able to dequeue and messages enqueued via the Java bean . Hoever I am not able to enqueue via Oracle SQL plus and dequeue via Java bean
I am thinking that I have not set sumthing properly but I have checked everything I know
P.S. - I am still learning all about AQ, so if I have missed an obvious solution, please let me know.
my code is quite simple - see below
l_enqueue_options dbms_aq.enqueue_options_t;
l_message_properties dbms_aq.message_properties_t;
l_msg_id xxaq.xxaq_imran_qt.msgid%type;
-- specifics for JMS Queues
l_queue_name varchar2(30) := 'XXAQ.XXAQ_IMRAN_Q';
l_payload SYS.AQ$_JMS_OBJECT_MESSAGE;
l_header SYS.AQ$_JMS_HEADER;
l_properties sys.AQ$_JMS_USERPROPARRAY;
l_replyto sys.aq$_agent;
l_data_items xxserror.xxsys_event_logs.data_items%type;
l_messages xxserror.xxsys_event_logs.message%type;
e_error exception;
l_bytes_len number(38);
l_bytes_raw raw(2000);
begin
l_properties := SYS.AQ$_JMS_USERPROPARRAY(
SYS.AQ$_JMS_USERPROPERTY('JMS_OracleDeliveryMode'
,100
,'2'
,null
,27));
l_properties.extend;
l_properties(2) := SYS.AQ$_JMS_USERPROPERTY('APPLICATION_ID' -- name
,200 -- type
,null -- str_value
,p_app_id -- num_value
,24); -- java_type
l_properties.extend;
l_properties(3) := SYS.AQ$_JMS_USERPROPERTY('TRIGGER'
,100
,p_event_type
,null
,27);
-- The replyto element seems to contain the following values
l_replyto := sys.aq$_agent(' ', null, 0);
l_header := sys.aq$_jms_header
(l_replyto
,null
,'XXAQ' -- User
,null
,null
,null
,l_properties);
-- Now build up the message.
-- l_header.properties := l_properties;
l_bytes_raw := utl_raw.cast_to_raw(p_app_id);
l_bytes_len := length(l_bytes_raw);
l_payload := sys.aq$_jms_object_message
(l_header
,l_bytes_len
,l_bytes_raw
,null);
dbms_aq.enqueue(queue_name => l_queue_name
,enqueue_options => l_enqueue_options
,message_properties => l_message_properties
,payload => l_payload -- payload + header
,msgid => l_msg_id);

Hi, have you got the solution of the problem? I am encountering the same issue here too. Thank you!

Similar Messages

  • Getting an Error in Deploying JMS and Message Driven Beans

    HI ,
    When I m trying to deploy my application It is giving the following exception cn any one plz help ..
    I think m not writing correct XML so can any one plz give me any help regarding How to write XML..
    0,333 ERROR [JMSContainerInvoker] Could not set ExceptionListener to null
    ms.IllegalStateException: The connection is closed
    at org.jboss.mq.Connection.setExceptionListener(Connection.java:559)
    at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStopDelivery(JMSContainerInvoker.java:973)
    at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.run(JMSContainerInvoker.java:1447)
    at java.lang.Thread.run(Thread.java:595)
    0,333 ERROR [JMSContainerInvoker] Could not stop JMS connection
    ms.IllegalStateException: The connection is closed
    at org.jboss.mq.Connection.stop(Connection.java:694)
    at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStopDelivery(JMSContainerInvoker.java:987)
    at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl.run(JMSContainerInvoker.java:1447)
    at java.lang.Thread.run(Thread.java:595)

    This issue is resolved now. All i have to do to turn off the Proxy Server Settings from my Jdeveloper. I turned off the settings and deployment went well.
    Thanks to Prasen for the solution.

  • Can I purchase a iTunes gift certificate to send to an email address via the iTunes app and not via the desktop?

    It would be super convenient to be able to purchase the gift certificate via email option from the iPhone using the iTunes app or even the Apple Store app so the recipient receives immediately but I don't see that this is possible.  I also can't see my purchase history without logging into the computer. This seems super odd for apple not to provide all options from the iPhone directly so I must be overlooking something. At this time of the year and with the economy as bad as it is, I'm not too keen to send gift cards in the mail!
    Thanks much for the help.

    mandyfar wrote:
    I got a gift card that says "Itunes"on it and not "apple"or something like that...
    I was wondering if that gift card can only be used on the itunes store, meaning I can only buy songs, tv shows, music videos , etc.. ...
    That is Correct...
    iTunes Gift Options
    http://support.apple.com/kb/HT2736

  • Recording Voice-Over via Final Cut Pro and Recording Via Pro Tools?

    Hey all,
    I'm recording some voice-over for a documentary shot on DV.
    Here's my question: all other factors being the same, is there any disadvantage in terms of audio quality of recording into Final Cut (through an m-box2) using the voice-over tool, or recording into M-Powered Pro Tools using the mbox 2 (and then bringing the file to Final Cut)?
    Pro Tools obviously allows for a far more sophisticated treatment of the sound after it has been imputed - but in terms of using it for capture?
    I know that Pro tools allows 24bit recording, but I'd probably record at 16bit anyway so as to match the sample rate of the rest of my audio in the project.
    I'd be using the same mic-xlr-mbox2 set-up and the same computer, does anyone have any views on the difference in the quality of the recorded audio?
    Thanks
    Richard O'Sullivan
    San Francisco

    actually an in point by itself won't help you
    a valid recording range needs both In and Out point, or simply a clip in the timeline which by its presence denotes the recording range
    the recording range must be less than 5 minutes
    in a blank timeline some like to throw a slug in there to mark the recording range, i find it easiest to just enter a duration in the canvas (i type 4.. in the duration field at top left of the canvas and it automatically marks a 4 minute range)

  • Problems enqueuing a CLOB on JMS_TEXT queue and dequeue from JMS

    Hi, I have a PL/SQL procedure that enqueues in a JMS_TEXT queue a CLOB, and a MDB in J2EE reading messages from that queue. The problem is that text from dequeued messages appears as null in java, but if I send messages to the queue using Varchar2 I get the correct message. What's wrong?? Thanks.

    Hi,
    I encountered the same problem. The fix was to use a more recent aqapi13.jar:
    if last modification date is 22th April 2002, then it does not read CLOB content.
    if last modification date is 14th October 2004, then it does read CLOB content.
    Note I am using Oracle 9i Release 2.

  • Send attachment via Receiver FILE/JMS adapter without using any Mapping.

    Hi,
    R/3 program creates one (encoded) text file, which I want to send via Proxy to JMS adapter without any mapping or FCC.
    Note: I don't want to use File adapter to pick the file from R3 dir and then send it to JMS.
    Reference: I have gone through below mentioned blog which produces the attachment in the XI payload but I am not able to write the same attachment to my XI dir using Receiver File adapter (File adapter is just for testing actual adapter will be used as Receiver JMS adapter).
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    Regards,
    Sarvesh

    > note sure why you want to complicate things here
    Actually the idea was to explore the possibilities of "Proxy with attachment". And I also wanted to confirm with experts like you before going to other options. Anyway it seems it's only possible with mail adapter.
    Reason for exploring above possibility: Since ABAP team has to create one text file and encode it, so we thought to call the outbound proxy in the ABAP program to send the same file as an attachment and then simply send it to JMS. Which is quite obvious thinking when you don't want to manage a share directory between R3 & XI or don't want to manage FTP user and pwd.
    > i think the simplest thing is to go for a simple file to jms configuration unless you have any specific reasons for not doing so.
    This we already kept in our mind as a last option in case if above thing is not possible then we can easily do it by this way.
    Thanks a lot for suggestion.
    Regards,
    Sarvesh

  • How to configure global transaction wthin Oracle AS JMS and Oracle JMS

    How to configure global transaction if I take a message from Oracle JMS(AQ) and send it to the Oracle JMS?

    Which version of OC4J are you working on?
    In OC4J 10.1.3.x, presume your OC4J JMS listens messages via MDB which uses a resource adapter as a message listener. The resouce adaper could be the generic JMS adapter deployed in OC4J as the default.
    Resource adapter configuration to support MDBs is included in the standard ra.xml file, which lists the message listener types that the resource adapter supports.
    The MDB developer or deployer configures the MDB in the ejb-jar.xml file, through a <message-driven> element.
    In addition to above, configuration in the ejb-jar.xml file specifies whether an MDB uses transactions.
    1) The <transaction-type> subelement of <message-driven> in ejb-jar.xml has a value of Container, and the <trans-attribute> subelement of <container-transaction> (under the <assembly-descriptor> element) has a value of Required. In this circumstance, if there is an imported transaction, then message delivery and related work are performed within that transaction. If there is no imported transaction, OC4J creates a transaction, and message delivery and related work are performed within that transaction.
    2) The <transaction-type> subelement of <message-driven> in ejb-jar.xml has a value of Bean. In this circumstance, the MDB manages the transaction. If a transaction is imported, OC4J will suspend it before the message delivery method call to the MDB, in order to avoid conflict.
    Message delivery is not transacted if the <transaction-type> subelement of <message-driven> in ejb-jar.xml has a value of Container, but the <trans-attribute> element has a value of NotSupported. If there is an imported transaction in this circumstance, OC4J will suspend the transaction before the message delivery method call to the MDB.
    Details could be found from OC4J Resource Adapter Guide.

  • Pros and Cons of using REST over JMS (and other technologies)

    Hey all,
    I am working on a project where we were using JMS initially to send messages between servers. Our front end servers have a RESTful API and use JEE6, with EJB 3.1 entity beans connected to a mysql database and so forth. The back end servers are more like "agents" so to speak.. we send some work for them to do, they do it. They are deployed in GlassFish 3.1 as well, but initially I was using JMS to listen to messages. I learned that JMS onMessage() is not threaded, so in order to facilitate handling of potentially hundreds of messages at once, I had to implement my own threading framework. Basically I used the Executor class. I could have used MDBs, but they are a lot more heavyweight than I needed, as the code within the onMessage was not using any of the container services.
    We ran into other issues, such as deploying our app in a distributed architecture in the cloud like EC2 was painful at best. Currently the cloud services we found don't support multi-cast so the nice "discover" feature for clustering JMS and other applications wasn't going to work. For some odd reason there seems to be little info on building out a scalable JEE application in the cloud. Even the EC2 techs, and RackSpace and two others had nobody that understood how to do it.
    So in light of this, plus the data we were sending via JMS was a number of different types that had to all be together in a group to be processed.. I started looking at using REST. Java/Jersey (JAX-RS) is so easy to implement and has thus far had wide industry adoption. The fact that our API is already using it on the front end meant I could re-use some of the representations on the back end servers, while a few had to be modified as our public API was not quite needed in full on the back end. Replacing JMS took about a day or so to put the "onmessage" handler into a REST form on the back end servers. Being able to submit an object (via JAXB) from the front servers to the back servers was much nicer to work with than building up a MapMessage object full of Map objects to contain the variety of data elements we needed to send as a group to our back end servers. Since it goes as XML, I am looking at using gzip as well, which should compress it by about 90% or so, making it use much less bandwidth and thus be faster. I don't know how JMS handles large messages. We were using HornetQ server and client.
    So I am curious what anyone thinks.. especially anyone that is knowledgeable with JMS and may understand REST as well. What benefits do we lose out on via JMS. Mind you, we were using a single queue and not broadcasting messages.. we wanted to make sure that one and only one end server got the message and handled it.
    Thanks..look forward to anyone's thoughts on this.

    851827 wrote:
    Thank you for the reply. One of the main reasons to switch to REST was JMS is strongly tied to Java. While I believe it can work with other message brokers that other platforms/languages can also use, we didn't want to spend more time researching all those paths. REST is very simple, works very well and is easy to implement in almost any language and platform. Our architecture is basically a front end rest API consumed by clients, and the back end servers are more like worker threads. We apply a set of rules, validations, and such on the front end, then send the work to be done to the back end. We could do it all in one server tier, but we also want to allow other 3rd parties to implement the "worker" server pieces in their own domains with their own language/platform of choice. Now, with this model, they simply provide a URL to send some REST calls to, and send some REST calls back to our servers.well, this sounds like this would be one of those requirements which might make jms not a good fit. as ejp mentioned, message brokers usually have bindings in multiple languages, so jms does not necessarily restrict you from using other languages/platforms as the worker nodes. using a REST based api certainly makes that more simple, though.
    As for load balancing, I am not entirely sure how glassfish or JBoss does it. Last time I did anything with scaling, it involved load balancers in front of servers that were session/cookie aware for stateful needs, and could round robin or based on some load factor on each server send requests to appropriate servers in a cluster. If you're saying that JBoss and/or GlassFish no longer need that.. then how is it done? I read up on HornetQ where a request sent to one ip/hornetq server could "discover" other servers in a cluster and balance the load by sending requests to other hornetq servers. I assume this is how the JEE containers are now doing it? The problem with that to me is.. you have one server that is loaded with all incoming traffic and then has to resend it on to other servers in the cluster. With enough load, it seems that the glassfish or jboss server become a load balancer and not doing what they were designed to do.. be a JEE container. I don't recall now if load balancing is in the spec or not..I would think it would not be required to be part of a container though, including session replication and such? Is that part of the spec now?you are confusing many different types of scaling. different layers of the jee stack scale in different ways. you usually scale/load balance at the web layer by putting a load balancer in front of your servers. at the ejb layer, however, you don't necessarily need that. in jboss, the client-side stub for invoking remote ejbs in a cluster will actually include the addresses for all the boxes and do some sort of work distribution itself. so, no given ejb server would be receiving all the incoming load. for jms, again, there are various points of work to consider. you have the message broker itself which is scaled/load balanced in whatever fashion it supports (don't know many details on actual message broker impls). but, for the mdbs themselves, each jee server is pretty independent. each jee server in the cluster will start a pool of mdbs and setup a connection to the relevant queue. then, the incoming messages will be distributed to the various servers and mdbs accordingly. again, no single box will be more loaded than any other.
    load balancing/clustering is not part of the jee "spec", but it is one of the many features that a decent jee server will handle for you. the point of jee was to specify patterns for doing work which, if followed, allow the app server to do all the "hard" parts. some of those features are required (transactions, authentication, etc), and some of those features are not (clustering, load-balancing, other robustness features).
    I still would think dedicated load balancers, whether physical hardware or virtual software running in a cloud/VM setup would be a better solution for handling load to different tiers?like i said, that depends on the tier. makes sense in some situations, not others. (for one thing, load-balancers tend to be http based, so they don't work so well for non-http protocols.)

  • Synchronize IR columns via plsql API

    Hi!
    I would like to use the package wwv_flow_worksheet_standard to synchronize the IR columns in my application out of plsql.
    Reason: My IR are based on views (simply: Select * from view_name) I have lots of them and they change frequently via plsql execute immediate.
    What I have tried is:
    DECLARE
    l_flow_id NUMBER (20);
    l_region_id NUMBER (20);
    l_query VARCHAR2 (4000);
    l_result VARCHAR2 (4000);
    BEGIN
    SELECT application_id, region_id, sql_query
    INTO l_flow_id, l_region_id, l_query
    FROM apex_application_page_ir
    WHERE page_id = 9 AND application_id = 133;
    APEX_040100.wwv_flow_worksheet_standard.synch_report_columns (p_flow_id => l_flow_id,
    p_region_id => l_region_id,
    p_query => l_query,
    p_add_new_cols_to_default_rpt => 'Y');
    COMMIT;
    END;
    Unfortunately it doesn't work. When executing the synch_report_columns procedure the following error raises.
    ORA-01003: no statement parsed
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1685
    ORA-06512: at "SYS.DBMS_SQL", line 629
    ORA-06512: at "APEX_040100.WWV_FLOW_WIZARD_API", line 840
    ORA-06512: at "APEX_040100.WWV_FLOW_WORKSHEET_STANDARD", line 2735
    ORA-06512: at line 23
    Can anyone help?
    Best regards,
    Mike

    Hello Joni!
    Thank you for your reply! Unfortunately this is not what I am searching for.
    I want to update the interactive report definition on my apex page out of plsql.
    E.g. the query of the IR on my page is: Select * from view_name
    When i add/remove columns from the view, the IR is broken. In order to repair the IR I need to logon to apex, edit every IR and save it again. Afterwards the new columns will appear in the report.
    Because my application has about 30 IR's and columns will change frequently I would like to script this step.
    The function APEX_040100.wwv_flow_worksheet_standard.synch_report_columns sounds like it does exactly what I need.
    Unfortunately what I tried doesn't work. (Look above)
    BR Michael

  • Refresh Interactive Report Definition via PLSQL

    Hello!
    I am currently working on set of generic database-apex applications.
    That means I have two applications. The first is the admin apex application used to define columns and tables.
    The second application is the one for the end users, where they can view and edit the values.
    My problem now is: Every time the admin adds or removes a column I need to edit the user-apex application, open the region definition of all interactive reports and switch to the report attributes to add/remove the columns of the report.
    I would like to automate this step via plsql. How can I achieve this?
    I guess the first step would be to load a list of all IRs...
    select * from apex_application_page_ir where application_id = 133;
    But I don't know how to reload the columns...
    Can anyone help?
    Thanks in advance!
    BR Mike

    Hello Andre, Hello Mimi!
    Thank you for your messages.
    First to your idea Mimi, i think you brought me on the right track. Using your update statement doesn't works for me.
    There are some missing permissions I couldn't grant and in addition I think this would hardly work because apex_application_page_ir is a complex view.
    But I am currently working on a solution using the wwv_flow_worksheet_standard.synch_report_columns function. Code like this:
    DECLARE
    l_flow_id NUMBER (20);
    l_region_id NUMBER (20);
    l_query VARCHAR2 (4000);
    l_result VARCHAR2 (4000);
    BEGIN
    SELECT application_id, region_id, sql_query
    INTO l_flow_id, l_region_id, l_query
    FROM apex_application_page_ir
    WHERE page_id = 9 AND application_id = 133;
    APEX_040100.wwv_flow_worksheet_standard.synch_report_columns (p_flow_id => l_flow_id,
    p_region_id => l_region_id,
    p_query => l_query,
    p_add_new_cols_to_default_rpt => 'Y');
    COMMIT;
    END;
    Unfortunately it doesn't work. When executing the synch_report_columns procedure the following error raises.
    ORA-01003: no statement parsed
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1685
    ORA-06512: at "SYS.DBMS_SQL", line 629
    ORA-06512: at "APEX_040100.WWV_FLOW_WIZARD_API", line 840
    ORA-06512: at "APEX_040100.WWV_FLOW_WORKSHEET_STANDARD", line 2735
    ORA-06512: at line 23
    Maybe you or someone else can reproduce the error?
    Therefor you simply need an interactive report on a page, based on a view. Remove some column of the view definition-the IR will display an error like this:
    ORA-20001: get_dbms_sql_cursor error ORA-00904: "DUV_FOCUS_OFFSET": invalid identifier
    Then execute the code above (use your page and app_id).
    After the execution the IR should work again. In my opinion...
    @Andre: The application I am working on is a critical pice of software used in a highly sophisticated semiconducter fab.
    It is simply impossible to train some of the shift leaders or operators on apex, in fact it is a great thread if someone else can change the application and produces a downtime.
    So for me it is necessary to script everything as far as possible. I finished nearly everything, simply the synch of the report columns is missing...
    BR Mike

  • Loading dimension via plsql

    Hi
    I am trying to create a dimension and load it via plsql and am able to create dimension and its corresponding table in database.I am quite unsure of how to load the dimension D_OFF from an equivalent relational table R_OFF
    I have a dimension D_OFF with following structure.
    Hierarchy:OFFKEY is child of OFF30 is child of OFF20 is child of OFF10
    Levels -->Attributes
    OFF10 ID--> CD ,DSCR
    OFF20 ID -->CD ,DSCR
    OFF30 ID-->CD ,DSCR
    OFFKEY ID-->CD,DSCR,UPDATE BY,UPDATE_DATE,CREATE BY, CREATE_DATE
    I have created the dimension and the table structure in the database and are as follows
    CREATE DIMENSION D_OFF
    LEVEL "OFF10" IS "OFF10_ID"
    LEVEL "OFF20" IS "OFF20_ID"
    LEVEL "OFF30" IS "OFF30_ID"
    LEVEL "OFFKEY" IS "OFFKEY_ID"
    HIERARCHY "STANDARD" (
    "OFFKEY" CHILD OF
    "OFF30" CHILD OF
    "OFF20" CHILD OF
    "OFF10"
    ATTRIBUTE "OFF10" DETERMINES ( "OFF10_CD", "OFF10_DSCR" )
    ATTRIBUTE "OFF20" DETERMINES ( "OFF20_DSCR", "OFF20_CD" )
    ATTRIBUTE "OFF30" DETERMINES ( "OFF30_DSCR", "OFF30_CD" )
    ATTRIBUTE "OFFKEY" DETERMINES ( "OFFKEY_DSCR", "UPDATE_DATE", "OFFKEY_CD", "UPDATE_BY", "CREATE_DATE", "CREATE_BY" )
    CREATE TABLE "D_OFF"
    ( "DIMENSION_KEY" NUMBER NOT NULL ENABLE,
    "OFF10_ID" NUMBER,
    "OFF10_DSCR" VARCHAR2(200),
    "OFF10_CD" VARCHAR2(500),
    "OFF20_ID" NUMBER,
    "OFF20_CD" VARCHAR2(500),
    "OFF20_DSCR" VARCHAR2(200),
    "OFF30_CD" VARCHAR2(500),
    "OFF30_DSCR" VARCHAR2(200),
    "OFF30_ID" NUMBER,
    "UPDATE_DATE" DATE,
    "CREATE_DATE" DATE,
    "UPDATE_BY" VARCHAR2(250),
    "OFFKEY_ID" NUMBER,
    "CREATE_BY" VARCHAR2(250),
    "OFFKEY_CD" VARCHAR2(500),
    "OFFKEY_DSCR" VARCHAR2(200),
    CONSTRAINT "OFFE_DIMENSION_KEY_PK" PRIMARY KEY ("DIMENSION_KEY")
    My source table is
    CREATE TABLE "R_OFF"
    ( "DIMENSION_KEY" NUMBER NOT NULL ENABLE,
    "OFF10_DSCR" VARCHAR2(200),
    "OFF10_CD" VARCHAR2(500),
    "OFF20_CD" VARCHAR2(500),
    "OFF20_DSCR" VARCHAR2(200),
    "OFF30_CD" VARCHAR2(500),
    "OFF30_DSCR" VARCHAR2(200),
    "UPDATE_DATE" DATE,
    "CREATE_DATE" DATE,
    "UPDATE_BY" VARCHAR2(250),
    "OFFKEY_ID" NUMBER,
    "CREATE_BY" VARCHAR2(250),
    "OFFKEY_CD" VARCHAR2(500),
    "OFFKEY_DSCR" VARCHAR2(200),
    Could you please let me know how to load the dimension via plsql.
    Best Regards,
    Sri

    I assume you're quite sure that the relevant dimension does at least sometimes get updated by the build process, and that you've searched the outline just in case the member was added somewhere you didn't expect.
    How is the data pulled in to the load rule? If it's from a relational database, check the SQL query used to extract it (could there be a WHERE clause restricting records)? If it's from a flat file, check the select / reject criteria set up in the load rule.
    Another possibility is that your load rule is set up to skip X lines at the beginning, and the new member appears there.
    You could build a brand new load rule against a test copy of the cube and confirm that ABC does build in successfully (that at least tells you that the problem is in your rule somewhere).

  • Enqueue and Dequeue of BLOB messages

    Hi all,
    Does anyone have any experience with enqueue and dequeue of BLOB messages? I have PDF files that I would like to send via aq. I can enqueue them, but not dequeue them. When I attempt to deque, I get the following error:
    ORA-25236: buffer too small for user data
    Here is my enqueue code:
    set serveroutput on size 1000000
    set timing on
    /* Enqueue to msg_queue: */
    DECLARE
       Enqueue_options     DBMS_AQ.enqueue_options_t;
       Message_properties  DBMS_AQ.message_properties_t;
       Message_handle      RAW(16);
       Message             blob;
         TmpMsg              blob := empty_blob;
         cnt                 number;
    BEGIN
       DBMS_AQ.ENQUEUE(queue_name => 'JOOSTENBERGVLAKTE',
       Enqueue_options            => enqueue_options,
       Message_properties         => message_properties,
       Payload                    => tmpmsg,
       Msgid                      => message_handle);
         select t.user_data into message from test_queue t where t.msgid = message_handle;
         select blob_content into tmpmsg from tbl;
         cnt := length(message) + 1;
         dbms_lob.erase(message, cnt);
         dbms_lob.trim(message, 0);
         dbms_lob.append(message, tmpmsg);
         dbms_output.put_line('Erased ' || cnt || ' characters');
         dbms_output.put_line('Message length ' || length(message));
       COMMIT;
    END;
    /And here is my deque code:
    set serveroutput on 1000000;
    declare
         l_options         dbms_aq.dequeue_options_t;
         l_properties      dbms_aq.message_properties_t;
         l_hnd             RAW(16);
         l_msg             blob := empty_blob;
    begin
         dbms_aq.dequeue(
              queue_name => 'JOOSTENBERGVLAKTE',
              dequeue_options => l_options,
              message_properties => l_properties,
              payload => l_msg,
              msgid => l_hnd
         commit;
    exception
         when others then
              rollback;
              raise;
    end;
    /

    Hi,
    I think you have the order of enqueueing and filling your blob in the wrong order. I understand why you do it, because inserting a blob in the table you could do that in this way. But I think that you should fill and close your blob before enqueueing it.
    Try something like:
    l_attachment blob;-- := :p_attachment;
    begin
    dbms_lob.createtemporary(l_attachment, false);
    dbms_lob.write( lob_loc => l_attachment
    , amount => length(:p_attachment)
    , offset => 1
    , buffer => utl_raw.cast_to_raw(:p_attachment));
    Another small remark is that I see you doing a commit right after the enqueue-dequeue. In your enqueu example it seems to make sense because you try to fill the blob afterwards. But you could also use the enqueue-dequeue option "visibility" and set that on dbms_aq.immediate. Then you don't have to do a commit. This is handy for enqueueing messages with out affecting your transaction.
    Regards,
    Martien

  • Function module like ENQUEUE and DEQUEUE for function location.

    Hi All,
    I should be highly appreciate if any one help me for locking function module like ENQUEUE and DEQUEUE
    for function location.
    Thanks
    Shaw

    Hi,
    You can either use the standard way of locking by using :
    data:lv_varkey          TYPE rstable-varkey.
    concatenate functional_location sy-mandt into lv_varkey .
    *   Lock table
        CALL FUNCTION 'ENQUEUE_E_TABLEE'
          EXPORTING
            mode_rstable   = 'E'
            tabname        = 'IFLOS'
            varkey         = lv_varkey
          EXCEPTIONS
            foreign_lock   = 1
            system_failure = 2
            OTHERS         = 3.
    *     Unlock table
          CALL FUNCTION 'DEQUEUE_E_TABLEE'
            EXPORTING
              mode_rstable = 'E'
              tabname      = 'IFLOS'
              varkey       = lv_varkey.
    Or,
    As mentioned above create a lock object via transaction SE11.
    Go to transaction se11:
    --> Enter lock object name e.g EZ_IFLOS
    --> Click on create
    --> Enter description
    --> Click on tables tab
    --> Enter 'IFLOS' as table name
    --> select lock mode
    --. click on save and activate.
    2 function modules will be created as DEQUEUE_EZ_IFLOS and ENQUEUE_EZ_IFLOS .
    Regards.

  • CMT and using non-Weblogic JMS in a session bean

              I am writing a session bean which sends a JMS message using a non-weblogic JMS
              provider. This bean is marked for CMT and I want the JMS send to participate in
              this CMT as well. My understanding is that I should be able to do this by defining
              a <resource-ref> element in the ejb-jar.xml and a corresponding <resource-descriptor>
              element in the weblogic-ejb-jar.xml file. The bean would then use the <res-ref-name>
              defined under the <resource-ref> element to lookup the connection factory. What
              do I have to put in weblogic-ejb-jar.xml file to make sure that the connection
              factory specified in <res-ref-name> maps to a connection factory that is in a
              foreign JNDI provider (e.g. in the non-Weblogic JMS provider's JNDI) and not in
              Weblogic's JNDI?
              Thanks in advance for your help.
              

    It sounds like you're using Tibco JMS to receive messages from the MDB, and
              then to send out a message. WLS 7.0 will handle the transaction enlistment
              properly when it receives messages for the MDB, but you'll have to enlist
              the JMS provider yourself when you send the message, using the white paper
              that Tom pointed you to as a guide.
              In WLS 8.1, coming soon, we'll automatically enlist the provider in the
              transaction if you look it up using a "resource-ref" element in the EJB like
              you described. Today, you can use that element but no transaction
              enlistement is being done.
              greg
              "Venkat" <[email protected]> wrote in message
              news:[email protected]...
              >
              > We also need this feature.
              > We are using Weblogic 7.0 and Tibco JMS 3.0,
              > which supports XA.
              >
              > We are mainly interested in subscribing using MDB
              > and publishing using a session bean in one transaction.
              > Do you think by using resource-refs in conjunction
              > with registering with Weblogic JNDI during startup
              > can do the job?
              >
              > Or how about using XAConnectionFactory and XASession
              > classes for JMS publishing ?
              >
              > Thanks.
              >
              > Tom Barnes <[email protected]> wrote:
              > >Hi Mihir,
              > >
              > >Support for automatic enlistment of foreign JMS vendors
              > >via the resource-ref approach is not available in WLS.
              > >This support will be available in the next release:
              > >limited access beta is available now, public beta is available
              > >in 2-3 months. You are the first customer I've heard of that
              > >asked for this feature. Very cool. Good timing.
              > >
              > >As you are not using WebLogic JMS, you will need to do the
              > >transaction enlistment yourself. This isn't that hard
              > >to do. I suggest that you refer to the integrating foreign
              > >JMS vendor white-paper available on dev2dev.bea.com.
              > >Also, refer to the integrating transactions with
              > >MQSeries integration paper, which will likely serve your
              > >purposes better. Note that some JMS vendors
              > >have problems with concurrent transactions in a single
              > >JMS connection, or with transactions that attempt
              > >to switch threads (eg. suspend() in one thread
              > >and resume() in another).
              > >
              >
              >http://dev2dev.bea.com/resourcelibrary/whitepapersdetail.jsp?highlight=whit
              epapers&filePath=components%2Fdev2dev%2Fresourcelibrary%2Fwhitepapers%2Fwp_j
              msproviders.htm
              >
              >http://dev2dev.bea.com/resourcelibrary/whitepapersdetail.jsp?highlight=whit
              epapers&filePath=components%2Fdev2dev%2Fresourcelibrary%2Fwhitepapers%2Fwp_j
              tatransactions.htm
              > >
              > >Tom
              > >
              > >mihir sharma wrote:
              > >> I am writing a session bean which sends a JMS message using a
              non-weblogic
              > >JMS
              > >> provider. This bean is marked for CMT and I want the JMS send to
              participate
              > >in
              > >> this CMT as well. My understanding is that I should be able to do this
              > >by defining
              > >> a <resource-ref> element in the ejb-jar.xml and a corresponding
              <resource-descriptor>
              > >> element in the weblogic-ejb-jar.xml file. The bean would then use the
              > ><res-ref-name>
              > >> defined under the <resource-ref> element to lookup the connection
              factory.
              > >What
              > >> do I have to put in weblogic-ejb-jar.xml file to make sure that the
              > >connection
              > >> factory specified in <res-ref-name> maps to a connection factory that
              > >is in a
              > >> foreign JNDI provider (e.g. in the non-Weblogic JMS provider's JNDI)
              > >and not in
              > >> Weblogic's JNDI?
              > >>
              > >> Thanks in advance for your help.
              > >>
              > >
              >
              

  • Attachment via PLSQL

    Dear All,
    I want to send a attachment via plsql.
    Please advise if we can attach file (text) from any directory from server.
    Regards,
    Shivaya

    If your file resides in the DB server then no matter which directory it resides in, if you have proper permission to access the directory all you need to do is create a directory object that refers to that path and use the directory object in your UTL_FILE.FOPEN
    UTL_FILE.FOPEN (
      location    IN VARCHAR2,
      filename    IN VARCHAR2,
      open_mode    IN VARCHAR2,
      max_linesize IN BINARY_INTEGER DEFAULT 1024)
      RETURN FILE_TYPE;

Maybe you are looking for