Consuming scheduler events

Not too sure what I am doing wrong:
1. Created an agent using:
SQL> exec dbms_scheduler.add_event_queue_subscriber('feedback_agent');
2. Created a table to hold the feedback:
SQL> create table test_event(a timestamp with time zone, b varchar2(100) );
Table created.
SQL> commit;
3. Submitted both the jobs:
v_job_name := 'job_'||p_job_id';
dbms_scheduler.create_job (
job_name => v_job_name,
job_type => 'EXECUTABLE',
job_action => '/home/user/testscript.sh',
number_of_arguments => 2,
start_date => p_start_time,
enabled => false,
auto_drop => true);
-- set the arguments
dbms_scheduler.set_job_argument_value (
job_name => v_job_name,
argument_position => 1,
argument_value => p_arg1_val);
dbms_scheduler.set_job_argument_value (
job_name => v_job_name,
argument_position => 2,
argument_value => p_arg2_val);
DBMS_SCHEDULER.SET_ATTRIBUTE(v_job_name, 'raise_events', DBMS_SCHEDULER.JOB_SUCCEEDED);
dbms_scheduler.create_job('Feedback_'||p_job_id,
job_type=>'plsql_block',
job_action=>
'insert into test_event values(systimestamp, ''second job runs'');commit;',
event_condition => 'tab.user_data.object_name = '''||v_job_name||'''',
queue_spec =>'sys.scheduler$_event_queue,feedback_agent',
enabled=>true);
-- Enable the first job so that it starts running
dbms_scheduler.enable(v_job_name);
4. The actual jobs execute - but the feedback event is never captured. I see the "feedback_x" jobs sitting in the queue with teh following query:
select *
from user_scheduler_jobs

Hi,
I found one bug in your code - in the event condition you are using v_job_name which is e.g. 'job_1' but the actual job name will be canonicalized so the actual job name will be 'JOB_1' . You can fix this in several ways
- start off with v_job_name being uppercased
- put it in double-quotes when creating the job so the job name will remain lowercased
- in the event condition use UPPER()
Here is a simple test case which works (note that we use an uppercased J1 in the event condition).
Hope this helps,
Ravi.
-- simple event job
exec dbms_scheduler.add_event_queue_subscriber('feedback_agent');
create table test_event(a timestamp with time zone, b varchar2(100) );
begin
  dbms_scheduler.create_job (
    job_name => 'j1',job_type => 'plsql_block',
    job_action =>
'insert into test_event values(systimestamp, ''first job runs'');commit;',
    number_of_arguments => 0, enabled => false, auto_drop => true);
  dbms_scheduler.set_attribute('j1', 'raise_events', DBMS_SCHEDULER.JOB_SUCCEEDED);
end;
begin
  dbms_scheduler.create_job('j2',
    job_type=>'plsql_block',
    job_action=>
  'insert into test_event values(systimestamp, ''second job runs'');commit;',
    event_condition => 'tab.user_data.object_name = ''J1''',
    queue_spec =>'sys.scheduler$_event_queue,feedback_agent',
    enabled=>true);
  -- Enable the first job so that it starts running
  dbms_scheduler.enable('j1');
end;
/

Similar Messages

  • Deleting a Scheduled Event in iCal ?

    Okay, I scheduled a few things and, alas, life being what it is, I had to make some changes. However, I found I was unable to delete the initialed scheduled event--I finally resorted to just "cutting" it. Is this the only way to delete an event?
    <Edited by Moderator>

    Make sure you select/highlight the actual item, not just the day or time, and then hit delete.
    Cheers
    Rod
    Message was edited by: Rod Hagen

  • Job not getting triggered for Multiple Scheduler Events

    hi,
    I would like a job to be triggered for multiple scheduler events, subscribing to a single event works fine. But, when I set multiple event condition, nothing works.
    My objective is to run a job, whenever job starts or restarts or exceeds max run duration.
    Note : Is it possible to trigger a job, when a job RESTARTS by subscribing to JOB_START ????????
    procedure sniffer_proc(p_message in sys.scheduler$_event_info)
    is
    --Code
    end sniffer_proc
    dbms_scheduler.create_program(program_name => 'PROG',
    program_action => 'sniffer_proc',
    program_type => 'stored_procedure',
    number_of_arguments => 1,
    enabled => false);
    -- Define the meta data on scheduler event to be passed.
    dbms_scheduler.define_metadata_argument('PROG',
    'event_message',1);
    dbms_scheduler.enable('PROG');
    dbms_scheduler.create_job
    ('JOB',
    program_name => 'PROG',
    * event_condition => 'tab.user_data.event_type = ''JOB_OVER_MAX_DUR''' ||*
    *' or tab.user_data.event_type = ''JOB_START''',*
    queue_spec => 'sys.scheduler$_event_queue,auagent',
    enabled => true);
    I tried this too...
    dbms_scheduler.create_job
    ('JOB',
    program_name => 'PROG',
    * event_condition => 'tab.user_data.event_type = ''JOB_OVER_MAX_DUR''' ||*
    *' and tab.user_data.event_type = ''JOB_START''',*
    queue_spec => 'sys.scheduler$_event_queue,auagent',
    enabled => true);
    Need help
    Thanks...
    Edited by: user602200 on Dec 28, 2009 3:00 AM
    Edited by: user602200 on Dec 28, 2009 3:03 AM

    Hi,
    Here is complete code which I tested on 10.2.0.4 which shows a second job that runs after a first job starts and also when it has exceeded its max run duration. It doesn't have the condition but just runs on every event raised, but the job only raises the 2 events.
    Hope this helps,
    Ravi.
    -- run a job when another starts and exceeds its max_run_duration
    set pagesize 200
    -- create a user just for this test
    drop user test_user cascade;
    grant connect, create job, create session, resource,
      create table to test_user identified by test_user ;
    connect test_user/test_user
    -- create a table for output
    create table job_output (log_date timestamp with time zone,
            output varchar2(4000));
    -- add an event queue subscriber for this user's messages
    exec dbms_scheduler.add_event_queue_subscriber('myagent')
    -- create the first job and have it raise an event whenever it completes
    -- (succeeds, fails or stops)
    begin
    dbms_scheduler.create_job
       ( 'first_job', job_action =>
         'insert into job_output values(systimestamp, ''first job runs'');'||
         'commit; dbms_lock.sleep(70);',
        job_type => 'plsql_block',
        enabled => false, repeat_interval=>'freq=secondly;interval=90' ) ;
    dbms_scheduler.set_attribute ( 'first_job' , 'max_runs' , 2);
    dbms_scheduler.set_attribute
        ( 'first_job' , 'raise_events' , dbms_scheduler.job_started);
    dbms_scheduler.set_attribute ( 'first_job' , 'max_run_duration' ,
        interval '60' second);
    end;
    -- create a simple second job that runs when the first starts and after
    -- it has exceeded its max_run_duration
    begin
      dbms_scheduler.create_job('second_job',
                                job_type=>'plsql_block',
                                job_action=>
        'insert into job_output values(systimestamp, ''second job runs'');',
                                event_condition =>
       'tab.user_data.object_name = ''FIRST_JOB''',
                                queue_spec =>'sys.scheduler$_event_queue,myagent',
                                enabled=>true);
    end;
    -- this allows multiple simultaneous runs of the second job on 11g and up
    begin
      $IF DBMS_DB_VERSION.VER_LE_10 $THEN
        null;
      $ELSE
        dbms_scheduler.set_attribute('second_job', 'parallel_instances',true);
      $END
    end;
    -- enable the first job so it starts running
    exec dbms_scheduler.enable('first_job')
    -- wait until the first job has run twice
    exec dbms_lock.sleep(180)
    select * from job_output;

  • How to consume key events

    I would like to create a subclass of TextBox that only allows numeric input. My idea was to provide my own onKeyType() handler and consume any key events that do not correspond to digits. However, I can't find any way to consume key events from further processing. How do I do this?
    Are there any other suggestions how to accomplish the task of providing your own filter concerning valid key input?
    /Bengt

    I also wanted a kind of validators for the TextBox class of JavaFX. So I've tried solving the problem using the SwingTextField class and some Java APIs. The following is my code for a SwingTextField accepting only digits, but I do want it to be much simpler.
    import java.awt.AWTEvent;
    import java.awt.event.AWTEventListener;
    import java.awt.event.KeyEvent;
    import java.awt.Toolkit;
    import javafx.ext.swing.SwingTextField;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javax.swing.JComponent;
    class DigitKeyEventHookListener extends AWTEventListener {
        public-init var  source:JComponent;
        public  override function  eventDispatched( event:AWTEvent):Void {
            if (event.getSource().equals(source)) {
                var keyEvent : KeyEvent = event as KeyEvent;
                var keyCharacter = keyEvent.getKeyChar();
                var isDigit = false;
                var code = keyEvent.getKeyCode();
               if ((KeyEvent.VK_0 <= keyCharacter) and (keyCharacter <= KeyEvent.VK_9)) {
                       isDigit = true;
                if ((code ==KeyEvent.VK_DELETE) or (code ==KeyEvent.VK_BACK_SPACE)) {
                    isDigit = true;
                if ((code ==KeyEvent.VK_LEFT) or (code ==KeyEvent.VK_RIGHT)) {
                    isDigit = true;
               if (not isDigit) {
                    keyEvent.consume();
    function createSwingTextField() : SwingTextField{
        var field = SwingTextField {
            columns:12
        var listener =  DigitKeyEventHookListener{
            source: field.getJTextField()
        Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
        return field;
    Stage {
        title: "Digit Box"
        width: 200
        height: 80
        scene: Scene {
            content: createSwingTextField()
    }

  • Call GET_SEARCH_REASULT service from scheduler event filter Iin UCM

    Hi,
    In our application, the mail should get sent to the content author on content revised date. For that, we have written a scheduler event filter component which will get invoked after every five minutes. In filter class I want to call GET_SEARCH_REASULTS service to get the list of contents and its authors to send mail.
    Can anybody please tell me how to call GET_SEARCH_REASULTS service from scheduler event filter?
    Thanks in advance.

    Hi Nitin
    Why cant you try writing custom query and custom service ?
    Please refer idoc script reference guide for getting the parametrs to be passed when using Get_search_results.

  • TS3999 There is no Europe/Minsk timezone in iCloud calendar interface. All scheduled events are displayed with 1 hour error.

    There is no Europe/Minsk timezone in iCloud calendar interface. All scheduled events are displayed with 1 hour error.
    Is there any workaround?

    Hello again, Kirik17.
    The concept still holds true. When clicking to select your time zone, you will need to select another city within your same Time Zone so that that one becomes your default.
    If you are still unable to select your Time Zone, you may find more information by using another one of Apple's Support Resources at: https://getsupport.apple.com/GetproductgroupList.action.
    Cheers,
    Pedro.

  • Can SOA consume business events using non-apps datasource ?

    Hi Gurus & Experts,
    We have a scenario where EBS raises custom business event to be consumed by SOA.
    Everything works fine using APPS login, however we need to non-apps datasource in some environements (custom schema user)
    Can SOA consume business events using non-apps datasource ?
    Please let me know.
    Thanks,
    Rev

    Hi Srini,
    Even i have a similar requirement . Could you please send me the link for OracleEBSAdapterUserGuide(b_28351). ?
    Did you come to know how to check whether WF_Listener is running ?
    Thanks in advance
    Nutan

  • How do I remove the tempature readings on my calendar? They fill up each day crowding out the view of scheduled events for the most part.

    How do I remove the tempature readings on my calendar? They fill up each day crowding out the view of scheduled events for the most part.
    Thank you
    Terry

    Disable or remoce the Calendar, that is creating these events, Terry.
    To find out, which calendar is creating these events, ctrl-click on one of the events and select "Get Info".
    In the Info panel click the color icon in the upper right corner to find out the calendar, that created this event.
    Then reveal the "Calendars" Sidebar (press the "Calendars" button in the toolbar) and select the Calendar, ctrl-click it and delete the calendar or disable it.
    -- Léonie

  • Producer Consumer & User Events with user input windows

    Hello All,
    I am planning to build Labview code using the Producer Consumer & User events pattern, the application needs multiple user input windows for things like personal data, feature selection etc, there could be around 15 or 20 distincts screen/panels required.
    The main question from me is... Is there a best practive approach to navigating/loading from one window to another etc, and also providing a way to to retrun to the previous window.
    Also I may need need to be running some slow logging and control hardware in the background while navigating some of the screens, this seems like the producer consumer vi will be running in the background while the user input causes a load/display window event.
    A simple Producer Consumer multiple winjdoow example would be very welcome. Thanks.
    Regards Chris

    I will second Mike's suggestion to use a central VI with subpanel(s).  It is usually less confusing than multiple windows.  Typically, the selection/navigation mechanism is on the left of the main panel, global info (like help) on the right, and the subpanel(s) in the center.
    The advantage of subpanels/subVIs is that you can launch your subVIs and keep them active in the background, even though they are not being used.  This means they will keep their state information and load into the subpanel almost instantaneously the next time you need them.  For a short tutorial on subpanels, check out this link.  Scroll down to the fourth reply for working code.  The original code posted is broken.
    Communication between your VIs or loops is typically done with either queues or event structures.  State information in each should be shift registers in the respective VIs.  If you have the time, I would highly recommend you learn how to use LabVIEW classes.  The command pattern is tailor made for this kind of application.
    Finally, avoid global data if you can.  Global data is anything that you can get to from anywhere (globals, functional globals, etc.).  Use of these can speed your development, but can also lead to sloppy design which will cause you major problems later.  If you really need globally available data, use a data value reference.  It is unnamed and requires a reference, which tends to enforce better programming practice.  Yes, there are instances where you truly need globally available, named data, but they are fairly rare.  You should only use them if you are experienced and really know what you are doing.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Scheduler - Event Based Jobs

    Hi,
    I've been trying to create an event based job dependent on multiple jobs. I tried queuing, but it seems like it can only hand one Job at a time. Also, chains were recommended to me, but I want the Job to run on the dependence on the Job that ran on specific program at the specific time. I currently know that chains can only handle, programs, other chains and/or events.
    In my mind chains wouldn't work, because If I wanted to run Job3 dependent on the outcome of Job1 running Program1 and Job2 running Program2, chains wouldn't be able to accomdate that. For it to happen in chains I would have to attach Program1 and Program2 to the new chain Job and that is not exactly what I would want.
    Can anyone help/clarify this situation for me. Thank you.
    Tony

    Hi Tony,
    So the requirement is to run a job after 2 prior jobs have completed.
    There are two ways I can think of to do this, both using events. In both cases you need to set job A and job B to raise events on completion (succeeded, failed or stopped) and setup an agent for the Scheduler event queue in the schema in which you are working
    dbms_scheduler.add_event_queue_subscriber('myagent')
    In order to get Job C to start after jobs A and B have completed there are 2 options.
    1) Let job C point to a chain and start running whenever job A has completed. The chain will have 2 steps, one event step waiting on B and one that runs your task C. An event step does nothing but wait for a particular event and complete successfully when the event is received. The second step will run when the event step waiting on job B has completed.
    So your chain would look something like
    begin
    dbms_scheduler.create_chain('chain1');
    dbms_scheduler.define_chain_event_step('chain1','stepB',
    'tab.user_data.object_name = ''JOB_B'' and
    tab.user_data.event_type IN(''JOB_SUCCEEDED'',''JOB_FAILED'',''JOB_STOPPED''',
    'sys.scheduler$_event_queue,myagent');
    dbms_scheduler.define_chain_step('chain1','stepC','finalTaskProg');
    dbms_scheduler.define_chain_rule('chain1','true','start stepB');
    dbms_scheduler.define_chain_rule('chain1', 'stepB completed', 'start stepC');
    dbms_scheduler.define_chain_rule('chain1', 'stepC completed', 'end');
    dbms_scheduler.enable('chain1');
    end;
    And your job would point to the chain and run whenever job_A completes (similar condition and queue_spec). It would keep waiting till job_B runs and then the final task would run and it would complete.
    2) The second way is to require job_A to insert a row into a table somewhere. Rule conditions can access table data so you could have job_C have an event condition which checks for a completion event for job_B and checks the table to see whether job_A has completed. Then the code you run should then remove the row in the table
    e.g.
    queue_spec=>'sys.scheduler$_event_queue,myagent'
    event_condition=>'tab.user_data.object_name = ''JOB_B'' and
    tab.user_data.event_type IN(''JOB_SUCCEEDED'',''JOB_FAILED'',''JOB_STOPPED''' and
    (select count(*) from mytab where col='job_A')>0'
    Then when running C do - delete from mytab where col='job_a';
    Both of these assume that job_A always completes before job_B but both of these will then run job_C after job_B completes. Modifying either of these so that either job A or B runs first is also possible by having another job that waits on A rather than B.
    Hope this helps, if you have any more questions, let me know.
    -Ravi

  • Scheduled Events

    Hi All. Firstly forgive me, but where is the forum search feature? If I enter criteria in the Search field next to the Support button, it seems to search the entire Apple site, not the forum.
    Now, to the question at hand. Since Day 1 I have had scheduled event dots beneath every single day of every month in my calendar. Why is this and how do I go about removing them? I do not have scheduled events every day in outlook, so why would they appear on the phone?
    TAI

    I finally understood how to execute java code every 5 minutes and 2 hours! But I still doesn´t know how to launch the "hello world" message in Content Server. I know how to show it by console with System.out.print("HELLO WORLD! \n"); but I would like to show it in the web browser in the content server.
    Thankss

  • POA Scheduled event question

    I am running GW7.03HP1 on NetWare 6.5 server. On the POA Scheduled event, I have setup a job that runs every night at 12:00a.m. Action=Analyze/Fix Databases, checked on Structure, Index check and Fix problems boxes.
    Is it true that I should not check on "Contents" box when I am running the Structure check?
    I want to get the user disk space total every night. When I check on "Update user disk space totals" box, it auto check on the "Contents" box.
    On the GUI, I can check on all boxes (I know that would take longer to complete). Any I going to get more trouble if I check boxes on Structure and Contents at the same time.
    Regars
    Andy

    On 6/3/2010 2:06 PM, andyj2009 wrote:
    >
    > I am running GW7.03HP1 on NetWare 6.5 server. On the POA Scheduled
    > event, I have setup a job that runs every night at 12:00a.m.
    > Action=Analyze/Fix Databases, checked on Structure, Index check and Fix
    > problems boxes.
    >
    > Is it true that I should not check on "Contents" box when I am running
    > the Structure check?
    >
    > I want to get the user disk space total every night. When I check on
    > "Update user disk space totals" box, it auto check on the "Contents"
    > box.
    >
    > On the GUI, I can check on all boxes (I know that would take longer to
    > complete). Any I going to get more trouble if I check boxes on Structure
    > and Contents at the same time.
    >
    > Regars
    > Andy
    >
    >
    10 years ago yes. Now, no.

  • Scheduling/Event app

    Hi
    I will like to develop a scheduling/events application  i.e users will know the event available for each day of the month through
    the year. I have prepared 365 events in text format located in my folder, i have also prepared the the date picker code already.
    how can i bind each text file event for each day to the date picker. When the user picks date it will display the event available for each day.
    see datepicker code below
    xaml.cs
    public partial class MainPage : PhoneApplicationPage
            Appointments appointments = new Appointments(); 
            // Constructor
            public MainPage()
                InitializeComponent();
                appointments.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(appointments_SearchCompleted);
                SearchCalendar(); 
                // Sample code to localize the ApplicationBar
                //BuildLocalizedApplicationBar();
            private void SearchCalendar()
                appointments.SearchAsync(DateBox.Value.Value, DateBox.Value.Value.AddDays(1), null);
            private void DateBox_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
                SearchCalendar();
            void appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
                if (e.Results.Count() == 0)
                    MessageText.Text = "no events for the selected day";
                else
                    MessageText.Text = e.Results.Count() + " events found";
                    DateList.ItemsSource = e.Results;
    Kindly help
    Jayjay john

    Hi Vineet24
    I followed the method below, but whenever i select the date picker it only gives the data for the present day, instead of picker days ahead/before.  How can i make it to pick future/past data
    See the code below
    xaml
    <toolkit:DatePicker x:Name="pickerdt" Margin="0,10,0,0" Header="Select date" VerticalAlignment="Top" ValueChanged="pickerdt_ValueChanged"/>
                <ScrollViewer Margin="0,105,0,10">
                    <TextBlock x:Name="textblock" TextWrapping="Wrap" Foreground="White"/>
                </ScrollViewer>
    xaml.cs
    private List<Devotion> devotions;
            public CalendarPage()
                InitializeComponent();
                devotions = new List<Devotion>();
                AddDevotions();
            private void pickerdt_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
                DateTime dt = DateTime.Now;
                int month = dt.Month;
                int year = dt.Year;
                int index;
                if (DateTime.IsLeapYear(year) || (month <= 2))
                    index = dt.DayOfYear - 1; // list is indexed from 0
                else
                    index = dt.DayOfYear; // add a day
                textblock.Text = devotions[index].ToString(); // or some other property
            private void AddDevotions()
                for (int i = 1; i <= 366; i++)
                    string filePath = "MyDevotions/Devotion" + i.ToString() + ".json";
                    Devotion d = ReadJsonFile(filePath);
                    devotions.Add(d);
            public Devotion ReadJsonFile(string JsonfilePath)
                Devotion[] d = null;
                using (StreamReader r = new StreamReader(JsonfilePath))
                    string json = r.ReadToEnd();
                    d = JsonConvert.DeserializeObject<Devotion[]>(json);
                return d[0];
    Reply soon
    Jayjay john

  • My calendar events disappeared this morning on my iPhone.  My scheduled events Re still there though

    This morning I looked at my calendar after being charged all night.  No events!  The scheduled events that I do every month were there but no appointments set!

    Hey there DonBak1954,
    Try using the steps in the following article to help you troubleshoot this issue with your calendar events on your iPhone:
    iCloud: Troubleshooting iCloud Calendar
    http://support.apple.com/kb/ts3999
    Thanks for being a part of the Apple Support Communities!
    Regards,
    Braden

  • Scheduling/event software

    Does anyone know of a scheduling/event registration program?
    This is a facility that hosts small events, meetings, and even has
    a couple of suites for over night visits. I've looked at creating
    this myself, but its more than I wish to get into at the moment.
    All the ones I really finding requires Windows servers and
    DBs, I need something that will work on *nix

    Hi Vineet24
    I followed the method below, but whenever i select the date picker it only gives the data for the present day, instead of picker days ahead/before.  How can i make it to pick future/past data
    See the code below
    xaml
    <toolkit:DatePicker x:Name="pickerdt" Margin="0,10,0,0" Header="Select date" VerticalAlignment="Top" ValueChanged="pickerdt_ValueChanged"/>
                <ScrollViewer Margin="0,105,0,10">
                    <TextBlock x:Name="textblock" TextWrapping="Wrap" Foreground="White"/>
                </ScrollViewer>
    xaml.cs
    private List<Devotion> devotions;
            public CalendarPage()
                InitializeComponent();
                devotions = new List<Devotion>();
                AddDevotions();
            private void pickerdt_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
                DateTime dt = DateTime.Now;
                int month = dt.Month;
                int year = dt.Year;
                int index;
                if (DateTime.IsLeapYear(year) || (month <= 2))
                    index = dt.DayOfYear - 1; // list is indexed from 0
                else
                    index = dt.DayOfYear; // add a day
                textblock.Text = devotions[index].ToString(); // or some other property
            private void AddDevotions()
                for (int i = 1; i <= 366; i++)
                    string filePath = "MyDevotions/Devotion" + i.ToString() + ".json";
                    Devotion d = ReadJsonFile(filePath);
                    devotions.Add(d);
            public Devotion ReadJsonFile(string JsonfilePath)
                Devotion[] d = null;
                using (StreamReader r = new StreamReader(JsonfilePath))
                    string json = r.ReadToEnd();
                    d = JsonConvert.DeserializeObject<Devotion[]>(json);
                return d[0];
    Reply soon
    Jayjay john

Maybe you are looking for