JMS ignoring settings to send a message as non-persistent

I'm trying to send a BUFFERED (as opposed to PERSISTENT) message using JMS. I
would expect the Oracle implementation of JMS to map the JMS
non-peristent delivery mode in the Oracle BUFFERED delivery mode.
However, try as I might JMS always sends messages as
persistent, sample below. Is there any way I can send a BUFFERED AQ message
using JMS?
import javax.jms.*;
import oracle.jms.*;
import oracle.xdb.*;
public class jmsbuftest
public static void main (String args [])
throws java.sql.SQLException, ClassNotFoundException, JMSException
try
String ora_sid = "***";
String host = "***";
String schema = "***";
String password = "***";
String queueName = "***";
int port = 1521;
Enqueue(ora_sid, host, schema, password, queueName, port);
System.out.println("You should see 3 messages in " + queueName.
They should be buffered but are persistent instead");
catch (Exception ex)
System.out.println("Exception: " + ex);
public static void Enqueue(String ora_sid, String host,
String schema, String password, String queueName, int port)
QueueConnectionFactory qc_fact = null;
QueueConnection q_conn = null;
QueueSession q_sess = null;
java.sql.Connection db_conn = null;
Queue queue = null;
AdtMessage adt_msg = null;
QueueSender q_sender = null;
oracle.xdb.XMLType xtype = null;
String data = null;
try
qc_fact = AQjmsFactory.getQueueConnectionFactory(host,
ora_sid, port, "thin");
q_conn = qc_fact.createQueueConnection(schema, password);
q_sess = q_conn.createQueueSession(true,
Session.CLIENT_ACKNOWLEDGE);
q_conn.start();
db_conn = ((AQjmsSession)q_sess).getDBConnection();
queue = ((AQjmsSession)q_sess).getQueue(schema, queueName);
q_sender = q_sess.createSender(queue);
adt_msg = ((AQjmsSession)q_sess).createAdtMessage();
data = "<bolek>olek</bolek>";
xtype = oracle.xdb.XMLType.createXML(db_conn, data);
adt_msg.setAdtPayload(xtype);
//try sending a buffered message, different ways, none of them
works!
((AQjmsQueueSender)q_sender).send(queue, adt_msg,
DeliveryMode.NON_PERSISTENT, 1,
AQjmsConstants.EXPIRATION_NEVER);
q_sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
((AQjmsQueueSender)q_sender).send(queue, adt_msg,
DeliveryMode.NON_PERSISTENT, 1,
AQjmsConstants.EXPIRATION_NEVER);
adt_msg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
((AQjmsQueueSender)q_sender).send(queue, adt_msg,
DeliveryMode.NON_PERSISTENT, 1,
AQjmsConstants.EXPIRATION_NEVER);
q_sess.commit();
q_sess.close();
q_conn.close();
catch (Exception e)
System.out.println("Exception: " + e);
}

I believe you need to use the Oracle specific methods with "buffer"in their name,
ie. (AQjmsProducer) bufferSend and (AQjmsProducer) bufferPublish. (Page 11-15 of Oracle® Streams Advanced Queuing User's Guide and Reference 10g Release 2 (10.2) )
So far I've been producing my buffered messages in PL/SQL. I'm receiving them using (AQjmsConsumer) .bufferReceive.
These require using the (now recommended) generic objects (not specific to Queue or Topic) ConnectionFactory, Connection, Session, MessageProducer.
I have tried to send buffered messages, and got close, but not got it to work. My core code is:
ConnectionFactory cfact = AQjmsFactory.getConnectionFactory(args[1], args[0], Integer.parseInt(args[2]), args[3]);
Connection conn = cfact.createConnection(SCHEMANAME, SCHEMAPWD); // user& password
// Send buffered probably needs non-transacted session
Session sess = conn.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
conn.start();
Queue queue = ((AQjmsSession)sess).getQueue(SCHEMANAME, QUEUENAME);
AQjmsProducer q_sender = (AQjmsProducer) sess.createProducer(queue);
q_sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
TextMessage txtmsg = sess.createTextMessage();
txtmsg.setText("Cars Distribution");
txtmsg.setJMSType("glopt");
txtmsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
q_sender.bufferSend(queue, txtmsg, 1,600);
Unfortunately I get errors :
JMS-204: An error occurred in the AQ JNI layer
JMS-242: Illegal attempt to enqueue message with both immediate visibility and three phase enqueue process.
It looks like I need to set visibility immediate, but I don't know how to do that in JMS. The AQjmsProducer.bufferSend API documentation says "When the in-memory queue is used, the enqueue operation is required to be in immediate visibility mode"
The queue create for this example was:
exec DBMS_AQADM.DROP_QUEUE_TABLE('DBEVENTQ_TABLE', force => true);
begin DBMS_AQADM.CREATE_QUEUE_TABLE(
Queue_table => 'DBEVENTQ_TABLE',
Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE',
Multiple_consumers => FALSE,
message_grouping => DBMS_AQADM.NONE,
Compatible => '10.0'
end;
begin DBMS_AQADM.CREATE_QUEUE(
Queue_name => 'DBEVENTQ',
Queue_table => 'DBEVENTQ_TABLE',
Queue_type => DBMS_AQADM.NORMAL_QUEUE,
Max_retries => 5,
Retry_delay => 0,
retention_time => 0 /* dont retain messages */
end;
exec DBMS_AQADM.START_QUEUE ('DBEVENTQ');
If you get past this JMS-242: Illegal attempt to enqueue message with both immediate visibility and three phase enqueue process, please tell me.
Regards, David

Similar Messages

  • TS2755 My wife and I both have iPhone 5s, I can't send text messages to non iPhone people that I use to but iPhone people I can, My wife can send text to non iPhone numbers.  I have checked and we both have the same settings.

    My wife and I both have iPhone 5s, I can't send text messages to non iPhone people that I use to but iPhone people I can, My wife can send text to non iPhone numbers.  I have checked and we both have the same settings.  Both of our phones are up to date 7.0.4.

    The ability to see and send calendar invites is a function of the calendar you are subscribing to and who owns it. We need more information, like what calendar are you subscribing to? MS Exchange? Google? Mobile Me?

  • HT201407 my 02 iphone 4s will not let me send picture messages to non iphone users

    my 02 iphone 4s will not let me send picture messages to non iphone users

    Do you have a setting in Settings > Messages for MMS Messaging and if so, is it on?

  • IPhone 4s wont send picture messages to non iPhone users.

    I've tried reinstalling the IOS 6, changing the settings, shutting off the phone. I can not send picture messages to non iPhone users but can send texts and receive texts and receive picture messages. just can't send. Help.

        jannwj, sending and receiving pictures is very important these days because we try to capture the moment all the time. I know this issue is frustrating because I take, send, and receive pictures at least 20 times a day. I researched  your issue and did not find this as a known issue. Do you receive a error message? I recommend checking your message settings to ensure they are enabled. I have listed the steps below:
    1) From the home screen, select Settings.
    2) Select Messages.
    3) From MMS Messaging, drag the switch left or right to enable / disable.  Enabled when set to ON.
    Please let me know if this helps. Also ensure the data network is enabled. I have listed steps below:
    1) From the home screen, select Settings.
    2) Select General.
    3) Select Cellular.
    4) Drag the Cellular Data switch left or right to enable / disable cellular data.
    On /Celluar data enabled
    Off /Cellular data disabled
    Keep us posted with the status of your issue.
    KinquanaH_VZW

  • Iphone 4 wont send picture messages to non iphone users

    im having this issue with my iphone where it wont send picture messages to non iphone users. this problem is all of a sudden, it used to work and now its not.  ive checked to see that my mms messages are turned on in settings and it still wont send. also picture messaging is included in the plan i have for the phone. any advice?
    thank you

    I downgraded back to 5.1.1 and I'm not having the problem I'm also on a gophone prepaid plan idk if that's te problem

  • Can you send text messages to non-ipod touch users

    Is there an app on the ipod touch you can download to send text messages to non-ipod touch users?

    if you are using imessages on your ipod you can only send messages to apple products suchs as ipad, iphone, and ipod touch .  but if you would like to send messages to a phone that is not an apple product you can download a texting app like text + or pinger.

  • Difference between a persistent messages  and non persistent messages in JM

    Hi
    This question is with respect to persistent messages , and non persistent messages .
    As per the docs it says that for persistent messages the QueueSender.send() blocks until it recivies an acknowledgement .
    Here my question is what is the difference between a persistent messages , and non persistent messages
    Thanks in advance .

    The exact behaviour depends on the JMS provider being used. But since non-persistent messages are defined to be unreliable, the provider may indeed decide that it's not necessary for the server to acknowledge the receipt of a non-durable message from a producer.
    Nigel

  • How to mark ALBPM messages as non-persistent?

    Hi,
    When using the WLS JMS Server, persistence for the messages sent through the queue is not required since ALBPM uses the JMS Queue as a dispatching mechanism only. However, since the messages sent to the Queue are marked as “Persistent”, you must mark the Queue as “Store Enable”. This will allow the WLS JMS Server to accept messages that are marked as “Persistent”. Is there any setting by which we can make these messages as non-persistent so that queues don't have to be store enabled?
    Regards,
    Xavier

    The idea behind this is to increase the speed by using non-persistent queue.
    Please help.
    Regards,
    Xavier

  • HT4203 settings to send picture messages

    hi i have an iphone 4 ,i bought it second hand on o2, and i find i cannot send picture messages to other phones, i am with o2 and contacted them and they gave me new settings to install which i have done , but still not able to send picture messages to other mobiles, i dont understand why i have put in the settings o2 sent me and it still does the same , can anyone help with this matter adam201052

    http://support.apple.com/kb/TS2755?viewlocale=en_US&locale=en_US

  • HT203977 My new IPad Air 2 will not let me send text messages to non Apple devices.  What can I do to fix this problem?

    I have a brand new IPad Air 2.  My operating system is 8.2.  I am not able to send iMessages (texts) to non Apple devices.  When I attempt to, the name is in red not green.  What can I do to fix this?

    An iPad is not capable of natively sending an SMS or MMS messages.  Those services require a cellular voice channel connection, and a data tablet is only capable of a cellular data channel connection, not a voice channel connection.
    If you have an iPhone, under the settings on the iPhone you can enable forwarding with your iPad - where the iPhone actually sends and receives the SMS texts and shares them with your iPad.
    Otherwise, you will need to use an app and internet service like the telegram messaging app. Or you can send emails to the persons cell phone via their carriers texting gateway (e.g. [email protected] if they use AT&T in the USA).
    iMessages between iOS apps are separate from SMS texts as iMessages use Apples internet service and equipment. But the SMS protocol crams a short text message into the residual bandwidth of a cellular phones voice channel and cannot be sent over a cellular data connection.

  • I can not send text messages to non apple phones from my ipad

    every since updated my iPad to latest software I can not send text messages to people with non Apple phones. When I type their name in it turns red.  How do I fix it?

    Hey angelafairfax,
    Thanks for the question. If you are experiencing issues with iOS 8 Handoff and Continuity features, you can follow the steps in this resource:
    Get help using Continuity with iOS 8 and OS X Yosemite - Apple Support
    http://support.apple.com/en-us/TS5458
    Thanks,
    Matt M.

  • Why can't i send text messages to non iphone users but have no problem sending them to people that have iphones?

    why can i not send sms and picture messages to non iphone users but have no trouble sending them to people who have iphones? help???

    .legoman. wrote:
    why can i not send sms and picture messages to non iphone users but have no trouble sending them to people who have iphones? help???
    Most likely your carrier has not enabled texting on your phone.

  • Is my iPad limited to iMessages? I can't seem to send text messages to non iPhone/iMessage users...grrrr

    Frustration is setting in after using my new mini iPad. My text messages seem to be limited to iMessages!?  Horrible since my friends and family are not all iphone users!  Is my iPad limited to iMessages? I cant text my daughter who has the Droid or others that don't have iMessage users!!!

    The phone number on the iPad is not active for cell voice, only for cellular data. You are not paying anything for voice or SMS (texting services) on your iPad, only for cell data. Texts to non-iOS devices would have to be SMS and use the cell voice system which is not present on your iPad.
    There are apps, such as TextFree, which will assign you a virtual phone number and allow you to emulate sending SMS messages from and to your iPad.

  • HT3529 can my daughter send text messages to non iphone users with only an apple id?

    Can you send a text message from ipod touch to non iphone users with only an apple id and no phone number?

    The Apple Messages app will only send Messages to another uses who has the Messages app on their iPod touch, iPad or iPhone. For Messsging an iPod touch or iPad you use the E-mail address they have in Settings>Messages>Send and Receive.  An Phone number will also be listed if they also have an iPhone with iOS 6 using the same Apple ID and yo can use the number.
    You can Message an iPhone by its phone number of the Apple ID email address listed in Settings>Messages>Send and Receive.

  • TS2755 I cannot text or send photo message to non iphone users since update.

    Since the update to ios7.0, I haven't been able to send text or photo messages to contacts that don't have an iphone. Is it an iphone problem or does it have something to do with my carrier (VERIZON).

    In settings/ messages do you have mms and send as SMS if iMessage is unavailable turned on

Maybe you are looking for

  • I can't save facebook photos to camera roll since upgrading to ios7

    can't save facebook photos to camera roll since upgrading to ios7, please help?  I press on photo, and menu comes up to save photo, but it is not in my camera roll.  What's up?

  • Outlook displays date of birthdays one day too early in MS Office 2007, 2010 and 2013

    Hi We are supporting several clients that has issues with Outlook. Different versions of Windows, Office and different exchange server versions. Some contacts' birthdays just "magically" changes to one day too early.  I have done extensive research w

  • Storing spaces content for next startup

    Hi I'm a new user on Mountain Lion, more used to Linux & Windows desktops, so a Mac 'newbie'. I'm a web developer and have always used multiple desktops - as built-in on Ubuntu and from 3rd party apps on Windows - to organise my work flow. Typically,

  • Spry menu ok in firefox but folded in IE.  Help please

    Hi I badly need some help. (1) my web page at  works fine in IE but the spry menu on the right is folding up.  the website is www.greenpwwhh.com.  The code is below. to get to the page click on puzzles then crossword (this works in IE but not in FF -

  • 3250 - crashes when playing music

    Hi all, anyone else have problems listening to M4A converted music tracks on your 3250? Mine crashes (reboots) probably once every couple of hours listening time on average. Sometimes rather than crashing completely it will instead skip a couple of s