Notification / Subcription in AQ

The following code is me trying to subcribe to the notifications that a new item has been queued. I can't get notification to the MessageAvailable subcriber. Any ideas?
I have confirmed that I have access to the queues (I created them) and that the subcription is valid but I'm not getting any notification. Other threads suggest that I set up the Consumer Name and Notification consumers but I'm getting no response.
Code Below :
using System;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
namespace WindowsFormsApplication1
public partial class Form1 : Form
string theConectionString = "user id=scott;password=tiger;data source=TTORCL";
private OracleConnection theConnection;
private OracleConnection theConnection2;
private OracleAQQueue theQueue;
public Form1()
InitializeComponent();
SetUp();
private void SetUp()
theConnection = new OracleConnection(theConectionString);
theConnection.Open();
theConnection2 = new OracleConnection(theConectionString);
theConnection2.Open();
OracleTransaction txn = theConnection2.BeginTransaction();
theQueue = new OracleAQQueue("JOBSQUEUE", theConnection2);
theQueue.NotificationConsumers = new string[1] { "JOHNDALY" };
theQueue.DequeueOptions.Wait = 0; // We will not wait for a message to become available
theQueue.DequeueOptions.Visibility = OracleAQVisibilityMode.OnCommit; // Messages only leave the queue when we commit.
theQueue.DequeueOptions.ConsumerName = "JOHNDALY";
theQueue.MessageAvailable += new OracleAQMessageAvailableEventHandler(IncomingMessageCallback);
txn.Commit();
public void IncomingMessageCallback(object sender, OracleAQMessageAvailableEventArgs e)
string message = "Notification Received...\n" + "QueueName : "
+ e.QueueName + "\n"
+ "Notification Type : " + e.NotificationType;
textBox1.Text = message + System.Environment.NewLine + "----------------------" + System.Environment.NewLine + textBox1.Text;
private void button1_Click(object sender, EventArgs e)
// Create queue
using (var queue = new OracleAQQueue("JOBSQUEUE", theConnection))
OracleTransaction txn = theConnection.BeginTransaction();
queue.MessageType = OracleAQMessageType.Raw;
queue.EnqueueOptions.Visibility = OracleAQVisibilityMode.OnCommit;
OracleAQMessage enqMsg = new OracleAQMessage();
enqMsg.Payload = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
enqMsg.SenderId = new OracleAQAgent("SCOTT");
queue.Enqueue(enqMsg);
txn.Commit();
//var txnt = theConnection.BeginTransaction();
//var m = queue.Dequeue();
textBox1.Text = System.Text.UTF32Encoding.UTF32.GetString(enqMsg.MessageId);
//txnt.Commit();
private void button2_Click(object sender, EventArgs e)
theConnection2.Dispose();
theQueue.Dispose();
theConnection.Dispose();
Application.Exit();
}

Here's the code I wrote (some time ago now) which sets up the receiver. Obviously it is just a snippet - hopefully for those variables which are declared elsewhere, you can infer their meaning from their name. If not, just ask. This code works for both single-consumer and multi-consumer messages.
Doesn't look too different to your code, although note however my last comment - the event only fires when a message arrives on a queue, not when messages are already on it. So it looks like I am doing a poll as part and parcel of the set up.
The only other thing to say is that I am purely listening in this scenario, so my code is kept quite clean. I noticed your scenario was both sending and revceiving - I don't see why there'd be a problem with this but maybe it'd be a good idea to strip your code down to the bare minimum at least until you've figured out what is going on?
Pete
/// <summary>
/// Creates the queues and initiates the pocess of IsListening and receiving of Aq messages
/// Note that we will always listen transactionally
/// </summary>
public void Start()
if (true == IsListening)
return;
//create the queue
Logger.Write("OracleAQXmlListener(Low-level): Creating the Queue:" + _queueName,
"Information", StandardPriorities.Low, TraceEventType.Information);
// Creates the internal connection and queue objects
if (null == _queue)
if (null == _connection)
connection = new OracleConnection(connectionString);
queue = new OracleAQQueue(queueName, _connection, ExpectedPayloadType);
// If a subscriber is specified, add a notification consumer
// Note that under the hood, the MessageAvailable event sets up notifications,
// and we need to explicitly register this consumer to receive notifications
if (false == string.IsNullOrWhiteSpace(_subscriberName))
// Add a consumer
_queue.NotificationConsumers = new string[1] {_subscriberName};
// We'll also take this opportunity to set some dequeue options
_queue.DequeueOptions.Wait = 0;                 // We will not wait for a message to become available
_queue.DequeueOptions.Visibility = OracleAQVisibilityMode.OnCommit;  // Messages only leave the queue when we commit.
_queue.DequeueOptions.ProviderSpecificType = true;                   // We specifically want an OracleXmlType tobe returned
// If a subscriber is specified, add a message consumer.
// Note that despite the line of code above to register for notifications, we must also,
// separately, register ourselves to dequeue messages.
// In short, both of these lines of code are required for multi-consumer queues
if (false == string.IsNullOrWhiteSpace(_subscriberName))
queue.DequeueOptions.ConsumerName = subscriberName;
// Try opening the connection. We know the connection is not currently open because of the call to IsListening
// earlier
Logger.Write("OracleAQXmlListener(Low-level): Opening the connection:" + _queueName,
"Information", StandardPriorities.Low, TraceEventType.Information);
_connection.Open();++
// Now register the callback method
// This must be done on an open connection
Logger.Write("OracleAQXmlListener(Low-level): Registering the callback:" + _queueName,
"Information", StandardPriorities.Low, TraceEventType.Information);
queue.MessageAvailable += new OracleAQMessageAvailableEventHandler(QueueMessageAvailable);
// Note that the message handler above only fires when a message arrives on the queue, it does
// not take account of messages that may already be on the queue.
// So we will be a little pro-active and process any messages that are on the queue currently
ReadQueueMessages(_connection, _queue);
...just for good measure...
private void ReadQueueMessages(OracleConnection connection, OracleAQQueue queue)
const int NO_MESSAGES_ON_QUEUE = 25228; // this is the number of the exception thrown by Oracle when
// there is a timeout on the queue.
// We hardwire the "listen" timeout value to be zero, so this
// exception essentially gets raised when there are no more
// messages to process
bool queueEmpty = false;
OracleTransaction tx = null;
try
while (false == queueEmpty)
try
tx = connection.BeginTransaction();
OracleAQMessage msg = queue.Dequeue();
tx.Commit();
FireReceiveEvent(msg);
catch (OracleException oex)
if (NO_MESSAGES_ON_QUEUE == oex.Number)
queueEmpty = true;
else
throw (oex);
// We'll hook into the event at this point. In its normal state, the event is set/signalled, and
// execution just flows through the call below (which returns immediately).
// However the event will be in a non-signalled state if the user has requested to shut down the
// service.
// In this event, the line below will block any forther flow.
// This is exactly what we want, however, because at this point in time we're in a totally clean state
// (i.e. we're not halfway through processing a message!)
_pauseEvent.WaitOne();
catch (Exception ex)
// Okay, an exception was thrown in the above block.
// First off, rollback any ongoing transaction
if (null != tx) tx.Rollback();
string sMessage = "MsmqListener(Low-level): OnReceiveCompleted throws Exception on queue: " + _queueName;
ex.Data.Add("Identifier", sMessage);
ExceptionReporting.ReportException(ex, "DefaultExceptionPolicy");
finally
if (null != tx)
tx.Dispose();
tx = null;
Edited by: Peter Hurford on 07-Mar-2011 05:55
Edited by: Peter Hurford on 07-Mar-2011 05:56

Similar Messages

  • Subcription or publication for service notification from CRM to R/3

    Hi,
    is there any subscription or publication available in order to send service notification from CRM to R/3??
    regards,
    Anirban

    Service notifications fall under the one-order concept. if it's possible to send the data, then it's with the business transactions subscription: assign it to the r/3 site and see what happens.
    M.

  • Not display notification in Notification tab

    Hi All,
    I would like to have an only "Notification" Tab in UWL.
    So, I went to System Admin> System Config > Universal Worklist Admin
    Then went to Universal Worklist Content Configuration
    Then Click to Configure Item Types and Customize Views Using a Wizard
    Edit Main page by removed all tab except "Notification" tab.
    then I created a subcription for one document in KM.
    For user1 whom has existing notifications, the new notification (above one) displayed fine.
    But for user2, tested notification doesn't display in UWL iView.
    Any configuration that I missed?
    Many thanks for all comments.
    Regards,
    Kanok-on K.

    Hi,
    maybe you have some cache to clean.
    You can also try to close your browser, clear your local and portal cache and relogging again.
    Fabien.

  • Can't get Email Notification to my Posted Topic!

    Hi guys,
    Anytime someone replies to my Posted Topic, I don't get an Email Notification. I used to get it! I checked my Subcription under Preferences and everything is configured correctly. I called Apple Support and they can't figure it out.
    Can someone tell me how I can fix this problem?
    Thanks,
    ZIA

    The last time it happened it was for about three days (as I recall). When they got it working again, I received 111 emails! Not looking forward to when they get this one fixed.

  • Timeouts and "cancelled" notifications...

    Greetings,
    We are using the standard (unmodified) version of the iExpense workflows (11.5.5 on Windows, WF 2.6.1), and have a curious and annoying problem...
    1. User submits expense report
    2. "Approval Request" notification times-out (after 5 days)
    3. "No Response" e-mail notification sent back to original user.
    4. "No Response" notification times-out (after 7 days)
    5. NEW "No Response" e-mail notification generated, and sent to original user.
    6. OLD "No Response" notification cancelled automatically.
    7. "CANCELLED: No Response" e-mail notification immediately sent to original user.
    8. Same pair of notifications generated one week later (new "No Response", plus "CANCELLED: No Response" notification referring the previous week's notification), and again a week after that, and so on...
    This is maddening to our users who miss the first message, because (after that first week), they are getting PAIRS of messages every week (only seconds apart) that seem to say to them...
    Message #1: Hey, there's a problem!!
    Message #2: Oh, never mind, no problem at all.
    Has anyone else encountered this problem? How did you handle it? Any ideas?
    Thanks a bunch!! -- Tom
    [email protected]

    Hm. I've confirmed 2396373 is the patch number. Here are the steps I used to locate the patch on MetaLink:
    1) Click the Patches button on the MetaLink navigation menu.
    2) In the Patch Download page, enter 2396373 in the Patch Number field.
    3) Click Submit. This should display the platforms where the patch is available.
    Could you try one more time with these steps and see if you can access it this way?
    Regards,
    Clara
    Thanks for the feedback.
    I searched MetaLink for both the specific patch number you gave, and also the phrase (description) you gave - with no results on either search. (???) Is this patch only visible by requesting it with a TAR, or by some other means?
    Please clarify, or double-check the patch number. Thanks a bunch!! -- Tom

  • SharePoint Foundation 2013 installed on Windows Server 2012 not sending out email notification

    I have a server where i installed SP Foundation 2013 on top of Windows Server 2012. I have configured the SMTP as well as the outgoing SMTP in Central Administration
    of SharePoint. When i create an alert on a document library, its did not sent any email notification on the changes made to the document in the document library. So, i created a workflow to send out email using SPD2013. The workflow run, but it cannot sent
    out email with error saying that outgoing email is not configured correctly. I have checked with another server which i installed SP foundation 2013 on top of Windows Server 2008 R2 - its sending out email just fine using same configuration and outgoing SMTP.
    I need help to resolve this issue or at least the cause of the problem.
    Any help is greatly appreciated.

         
    Try below:
    http://social.technet.microsoft.com/wiki/contents/articles/13771.troubleshooting-steps-for-sharepoint-alert-email-does-not-go-out.aspx
    Go to Central Admin ---->Operations----->outgoing email settings and verify that SMTP server is mentioned correctly 
    2) Test the connectivity with the SMTP server.
    In order to do that follow these steps:
      Open  cmd
      telnet <SMTP server name> 25 ( We connect smtp server to the port 25)  
                     you should see a response  like this 220 <servername> Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at date and time
                     Beware that different servers will come up with different settings but you will get something
                     If you dont get anything then there could be 2 possible reasons, either port 25 is blocked or 
                     the smtp server is not responding.
      For testing response from your server
                       For testing response say ehlo to it.
                            Type :
                                        ehlo <servername>
                            output:
                                        250 <servername> Hello [IP Address]
      Now a test mail can be sent from that SharePoint server. 
                          Now we need to enter the From address of the mail.
                          Type :
                           mail from: [email protected]
                           output:
                           250 2.1.0 [email protected]….Sender OK
     It's time to enter the recepient email address.
    Type : rcpt to: [email protected]
    output:
    250 2.1.5 [email protected]
     Now we are left with the data of the email. i.e. subject and body.
    Type : data
    output:
    354 Start mail input; end with <CRLF>.<CRLF>
    Type:
    subject: this is a test mail
    Hi
    This is test mail body
    I am testing SMTP server.
    Hit Enter, then . and then Enter.
    output:
    250 2.6.0 <<servername>C8wSA00000006@<servername>> Queued mail for delivery
    Type: quit
    output:
    221 2.0.0 <servername> Service closing transmission channe
    3)  Check alerts are enabled for your web application
          verify if the windows timer service is running or not.
          Run this stsadm command to check that
          Stsadm.exe -o getproperty -url http://SharePoint-web-App-URL -pn alerts-enabled
         This should return <Property Exist="Yes" Value="yes" />
         If you don’t get this, Enable alerts by:
         stsadm.exe -o setproperty -pn alerts-enabled -pv "true" -url http://SharePoint-web-App-URL
          If its already enabled, try turn off and turn on it back.
    4)  Check the Timer job and Properties
           Go to
           MOSS 2007:  Central Administration > Operations > Timer Job Definitions (under Global Configuration)
           In SharePoint 2010: Central Administration > Monitoring > Review Job Definitions 
           Check whether the "Immediate Alerts" job is enabled for your web application. check these properties:
                       job-immediate-alerts
                       job-daily-alerts 
                       job-weekly-alerts
           stsadm.exe -o getproperty -url "http://Your-SharePoint-web-App-URL" -pn job-immediate-alerts
           The expected output is:
           <Property Exist="Yes" Value="every 5 minutes between 0 and 59"/>.  
           If you don’t get this, run the following command to set its value.
           stsadm.exe -o setproperty -pn job-immediate-alerts -pv “every 5 minutes between 0 and 59" -url http://Your-SharePoint-web-App-URL
    5)  Check whether the account is subscribed for alerts and it has a valid email account. This should be the first thing to check if the problem persists for some users not for      all.
    6)  Then check if at all those users have at least read permission for the list. Because the first mail should go out for every user without security validation but the next ones       won't be delivered unless the user has at least read
    permission.
    7)  If it is happening for one user, can also try to delete and re add the user in the site.
    8)  Most importantly , you should try this one.
          Run this SQL query to the content db < Select * from Timerlock>
          This will give you the name of the server which is locking the content database and since when.
          In order to get rid of that lock 
          Go to that server which is locking the content db and then restart the windows timer service.
          within some time it should release the lock from content db, if not then at the most stop the timer job for some time
          Once the lock will be released then try to send some alerts
          You will surely get the email alert.
    I found this is the most probable reason for alert not working most of the time. We should start troubleshooting with above steps before coming to this step for any alert email issue but from step 1 to step 7 are best for new environments or new servers.
    If the issue is like this ,alert was working before and suddenly stopped working without any environmental change then above conditions in step 1-7 should be ideally fine.
    Even after this if it is not working, then you can try these few more steps too
    9)  Try re-registering the alert template:
    stsadm -o updatealerttemplates -url http://Your-SharePoint-Web-App-URL -f  "c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\alerttemplates.xml" -LCID 1033
    10)  Try to clear the configuration cache
    If this helped you resolve your issue, please mark it Answered

  • Alert or Notification for Client Open and Close

    Hi All,
    How to configure an Alert or Notification, if the Client (SCC4 and SE06) is open and in modifiable state, we have spoken to our solman team and got the confirmation that there is no MT Class for SCC4 and SE06.
    If this is possible through any z program, please do help and provide your comments and suggestions.
    Thanks & Regards
    Praveen

    It is possible to assign a different posting period variant to company code in a non-leading ledgers (the extreme right field) in the foll. node in SPRO.
    Financial Accounting (New) -> Financial Accounting Global Settings (New) -> Ledgers -> Ledger -> Define and Activate Non-Leading Ledgers

  • Whenever i try and open a social network app it comes up with an error message sayinng "Connect to itunes to use Push Notifications" I have successfully conntected to itunes via phone and computer however this message is still appearing and will not go?

    Whenever i try and open a social network app it comes up with an error message sayinng "Connect to itunes to use Push Notifications" I have successfully conntected to itunes via phone and computer however this message is still appearing and will not go, therefore i cannot use the apps?HELP PLEASE

    http://support.apple.com/kb/TS3281

  • Facebook Notifications and email notifications on ...

    Hi
    Is that possible Facebook Notifications and email notifications on sleeping screen nokia 808 like it had on N9..
    On my 808 it shows only msgs and miscalls....any fix??
    Thanks

    not possible unless the app supports that behaviour. but email notifications and on notification lights has been broken on Symbian for a while, and as Symbian is in maintenance mode, is unlikely to see a fix, possibly ever.

  • Ios7 and push notifications and music

    this update is really starting to annoy me now.
    everytime i go on texts/whatsapp/kik/ anything it tells me to connect my phone to itunes to use push notifications.. so i connected to itunes and got load of songs i didnt want on my phone and no push notifications.
    i have no idea how to delete the songs cause swiping accross doesnt work and clicking it just makes it play.. so help ??
    and how do i get my push notifications to work?! its driving me crazy
    i dont really wanna throw my phone at the wall but i can see it happening.....
    tia...

    https://discussions.apple.com/message/23019531#23019531
    Lots of people (myself included) are having similar issues.

  • Subscriptions and email notifications

    Is there a way to subscribe simply to a single question I post rather than to the entire topic, which results in tons of emails? Or is there a way (as with Mozilla forums) to be notified when a response is made to a thread I post?

    Something seems to be broken in discussion subscriptions. Every morning I get a notification that the same thread has been updated, but it has not. Let me paste in a portion of the messages. Please note the dates are different but the link remains the same (with the same messageID):
    ====
    The following updates have been made since 1/11/07 6:19 AM
    Topic "No System Sounds" has been updated one time
    http://discussions.apple.com/thread.jspa?messageID=3866231#3866231
    ====
    The following updates have been made since 1/10/07 6:19 AM
    Topic "No System Sounds" has been updated one time
    http://discussions.apple.com/thread.jspa?messageID=3866231#3866231
    ====
    The following updates have been made since 1/9/07 6:19 AM
    Topic "No System Sounds" has been updated one time
    http://discussions.apple.com/thread.jspa?messageID=3866231#3866231
    PowerMac G3 (Blue & White), iBook G3, MacBook Pro   Mac OS X (10.4.8)  

  • CWMS and email notifications

    We are in the planning stages for deploying cwms. In documentation, the various email templates are described briefly.
    Is there further resource on the templates? For example, what is customer modifiable? How are we limited - only certain sections of the MSG, can we incorporate simple graphics, is there a character count limit? Are there any examples of the templates available?
    Thank you for any info in advance.
    John Geyer
    Sent from Cisco Technical Support iPhone App

    Hi John,
    Essentially everything in the template is modifiable, and while there may be a character count limit, it is unlikely that any modifications will encounter that as notifications with hundreds of full lines of html and text can be delivered by the system.
    There are two types of templates, one for normal web scheduling that can be in either HTML or plain text, and one for meetings scheduled through productivity tools that only uses a plain text notification.
    Here is an example of a HTML notification that attendees receive:
    Hi %AttendeeName_HTML%,
    %HostName_HTML% is inviting you to this WebEx meeting:
    %Topic_HTML%
    Host: %HostName_HTML%
    When it's time, join the meeting from here:
    Join the meeting
    When: %MeetingDateOrRecurrence%, %MeetingTime%, %TimeZone%.
    Access Information
    Meeting Number:
    %MeetingNumber%
    Password:
    %MeetingPassword_HTML%
    Audio Connection
    %TeleconferencingInfo_HTML%
    Delivering the power of collaboration
    The %SiteURL_HTML% team %Support_HTML%
    %CustomFooterText_HTML%
    © %Year% Cisco and/or its affiliates. All rights reserved.
    While the plain text version that PT would send looks like this:
    %Topic%
    Host: %HostName%
    When it's time, join the meeting from here:
    %Meeting Link%
    Access Information
    Meeting Number:
    %Meeting Number%
    Password:
    %Meeting Password%
    Audio Connection
    %TeleconferencingInfo%
    Delivering the power of collaboration
    The %SiteURL% team
    %Support%
    %CustomFooterText%
    In the HTML version, images can be linked to and added to the notifications with normal HTML tags. There are also system variables such as %Meeting Password% and %SiteURL% that are filled in at the time the notification is generated. While many of them are self-explanitory, a comprehensive list of the variables and descriptions are not available. I'll see if this can be included into the notifications section of the Administration Guide.
    Thanks,
    Derek Johnson
    Conferencing TAC

  • Smartband and Google+ notifications

    Hi There,
    just received my Z2 with bundled smartband yesterday - loving it so far!
    I only wonder if notifications for google+ will be added to the apps list, as this would make the smartband my perfect companion.
    Thanks for your answer!
    kind regards,
    Alex

    I just realised that you can tap into notification and get more settings.
    By the way, Google + is there in the list:
    Xperia Z1 C6903 - 4.4.2 [ SmartWatch SW2 | SmartBand SWR10 ]

  • Keynote and Tweetdeck notifications

    I would like a  twitter feed to appear during my keynote presentations. I've tried tweetdeck, but the notifications do not appear in front of the presentation (when in slideshow mode). Is there a way to force the notifications to appear on top? Incidently they do appear on top with powerpoint.
    Cheers

    Users can obtain the iWorks and iLife applications free, if they purchased a Mac after the beginning of October 2013.
    Older Mac purchases require a paid purchase of these applications.

  • 8830 and Email Notifications

    Does anyone know of a way to shut off the email message indicator and the new mail (with star indicator) w/o affecting the email push?  Ie:  When I get home at night, I don't want to see how many messages I have or even the indicator that there is new messages because I feel compelled to look at it.  I have tried turning both off, but you either have one showing or the other.  
    Thanks.  

    Hey emma53, 
    Welcome to the forums ! 
    Are you still having this issue? If so then you may to try to back up and complete a clean reload of the device software as shown here http://bbry.lv/cG8oer. Before you restore your data test to see if the notifications are back.
    -SR
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

Maybe you are looking for

  • Saving in Version sets

    I have Elements 4.0 for windows.  All of a sudden I can't save my edits as versions sets and they don't appear in organizer at all.  I think they are getting saved, I just can't find them.  Also, I started having problems tagging pictures, sometimes

  • Following Error... Can't Resolve?

    What does the 175 tell me? All fileds, source and target loook OK? RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:Messages/ns0:Message1/ns1:MT_IA_Item/IA_ITEM[175]/Item_Desc. Check xml instance is valid for sou

  • Add to portal favorites works only in User-language english

    Hi, i've got a litte problem with the funktion "add to portal favorites". We use our portal to publish BW-Reports (BW7.0). Our development-language is english. Both system (BW and EP) are configured in english. In the portal (EP 7.0) we have the prob

  • Edge Animate will not startup

    I just update the latest version of Edge animate from Creative Cloud. My problemis, it will not startup. I am getting an error message which said: "The procedure entry point GetGestureInfo could not be located in the dynamic link library user 32.dll.

  • Copy Files -  Building an Installer

    Hi there team, I am trying to build a downloader of sorts but am getting hung up on the ... put fxObj.fx_FileCopyProgress("Content") ... line of code. Idealy I would like to copy files from a CD, save them to a Content folder created on the Mac HD an