Processing JMS messages in sequence one after another

This is my use case which I wan to implement in OSB.
1. I have a queue which will receive messages in huge numbers from a single sender.
2. I have a proxy which will read each message and process the message and send it out.
In step 1 , I want each message to be read sequentially and when step 2 finishes executing then I want to read the next message from the queue.
I need to give an acknowledgment to JMS that the message has finished processing and it can make the next message available to the proxy.
What is the best option to implement this use case ?.
Regards

By default Weblogic JMS Queues are FIFO. But that is true only if there is only one consumer of the queue.
In case of a clustered environment that is not true and in case of OSB even with a single managed server multiple threads are created for a JMS listener Proxy(by default 16). So there will be 16 instances of the Proxy trying to read messages from the Queue and each will be handed out a message and sequential integrity is disturbed.
There are three ways to overcome this problem:
1. Unit of Order
This is suitable only when you want messages of the same group to be processed sequentially while multiple groups can be processed in parallel.
For e.x. you are getting multiple orders for multiple customers and you want to ensure that the orders of same customer are processed sequentially (in case a customer tries to change the quantity of an order then the latest one should be processed last). In this case you can set UOO as the CustomerID and each customer's order will be processed sequentially but orders of different customers will be still processed in parallel. WLS JMS achieves this by assigning a target queue instance on the cluster for each UOO value. It will assign Q!MS1 to CustID=1, Q!MS2 to CustID=2 and so on. All messages of the same UOO(of the same customer) will go to the same instance on the queue. Furthermore it will ensure that no two messages of the same UOO are released together to the listeners. So if a queue instance has 5 messages each of both Cust=1 and Cust=2, only one message each of Cust1 and Cust2 will be processed by the listeners even if there are 16 listening threads.
Pros and Cons:
Overall performance is improved since you can still achieve some parallel processing.
There will be a slight overhead of processing the UOO headers on the JMS servers.
Can not ensure sequencing of all the messages. (Although you can achieve that by setting the same UOO on all the messages)
If the managed server assigned to a UOO is down, if a publisher tried to put the next message for that UOO, it will fail since it will not try to send that message to any other managed server.
2. Single threaded processing
If you don't want to process even different groups of messages in parallel and if you want absolute sequencing (i.e. irrespective of the CustomerID you want all the messages to be processed in the sequence they arrive) you will need to process them in a single threaded model. The JMS queue should be deployed on only one managed server of the cluster. The JMS proxy listening to the queue should also be deployed on a single managed server(You will need to change the targeting for the EJB created for this Proxy in the Deployments) and there should be a Work Manager for this Proxy with Maximum Thread Constraint set as 1. In the Connection Factory which the Proxy uses, set the Maximum Messages per session to 1. Another approach for Single threaded could be to set the same value of UOO on all of the messages. This will make all the messages to go to the same Q instance in the cluster and also will make sure that even if Proxy has multiple threads, only one message will be processed at a time.
Pros and Cons:
Completely single threaded processing, will take more time since messages will be processed one after the other.
Load balancing will go awry as all the messages will be processed by only one server.
3. Using custom implementation
The most complex way is to create a completely custom implementation. Put all the messages in a DB and then process them one at a time based on timestamp.
Pros and Cons:
It will take more effort to implement than the other two approaches.
It will again need single threaded processing after the messages are put on the DB
Performance wise there will be more impact because of additional DB calls
More complex to maintain
Based on your exact requirements you can choose which approach you want. If you have SOA suite as well them it would be better to move this solution to SOA suite as OESB(Mediator) component of SOA suite has re-sequencing feature.

Similar Messages

  • JMF Play files in a sequence one after another

    Hi
    i developed a JMF based player for playing more than one files in a sequence one after another.
    problem is that it playes all files at same time.
    it should run 2nd file when one file is completed.

    I think time period or state of media will be helpful

  • FCP7 - Queue sequences to render one after another

    FCP7
    I'm restoring some old analogue tapes.
    Each SEQUENCE is about 20 to 30 minutes long.
    I preform cropping, colour correction and apply the Neat Video Noise Reduction filter to each sequence.
    Rendering of each clip takes about 2 to 3 hours approx.
    I set up 3 to 4 SEQUENCES which I'd like to render overnight.
    I have been reading the FCP manual and searching the net and the Apple forums.
    As far as I can tell there is no such thing as a "Render Queue" for Sequences in FCP.
    ie; you add several unrendered sequences to a queue and click "render" and each renders in turn.
    Could someone confirm this for me please?
    So;
    - Is there another way in FCP7 to render sequences one after the other?
    I'll try putting 3 sequences together in another sequence and see how that goes.
    Just not sure if I can seperate them afterwards while retaining the render.
    Thank you.
    Robert.

    Ok, let me see if I understand this correctly.
    - I have a number of sequences which are unrendered.
    - I add them all to batch export.
    - As the unrendered files are exported, they are rendered.
    - The rendered sections are not retained in the sequence in FCP.
    - The rendered sections exist only in the exported files.
    Is that right?

  • When I try and open Microsoft Word 2011 documents they start opening one after another at a rapid speed and I can't stop it. I reboot and same thing happens?

    When I try and open Microsoft Word 2011 documents on my  IMAC they start opening one after another at a rapid speed and I can't stop it. I reboot and same thing happens. The documents open in rapid succession on their own and don't stop until I force close or after maybe 100 or more open I start getting the following message for each document attemting to open "This document could not be registered. It will not be possible to create links from other documents to this document" and then in paretheses the name of the document. After I click okay another trys to open. Any suggestions?

    If you had multiple documents open and quit the app without closing all of the docs first, it will open them again when you launch the app. Open Word, and then close all the documents, you may be asked to save the document, if the document was already saved but you made changes to it before you quit the app, you may need to save the changes first, shorcut ( command and s keys). After you close all of the documents then quit the app and restart the computer. See if this works.

  • How to play two presentations from the DMP one after another and looping

    Can anyone help me on this.I want to play two presenations one after another and looping from the DMP.

    Semuhtu,
    The easiest solution for looping two or more DMD presentations
    is to create a nested playlist within DMD.  You simply
    create a master presentation and add a playlist to this
    presentation.  Add the desired presentations to this playlist
    and then schedule or send the Action to the DMP(s) to play
    the Master Presentation.  The 2 or more child presentations will
    play and loop until you stop it manually.
    Summary of Tasks
    * Using DMD create Presentations (2 or more) that you would like
      to display on the DMP-Display(s).
    * After the presentations are created, you will need to find out
      what the URL addresses are for each presentation. Using the
      "Actions" drop down on the DMM-DMP Manager screen, you select
      a DMP and send the Presentation to the DMP.  Once the DMP displays
      the presentation, access the DMP-DM Web admin page and copy the URL
      address in the "Startup URLs-->Browser" field.   Repeat this process
      for each DMD presentation that you want to loop.
      For example:
      http://dmm.company.com:8080/xTAS-core/appgen/clad/clad_95_.htm
      http://dmm.company.com:8080/xTAS-core/appgen/clad/clad_96_.htm
      and so on...
    * Another parameter or variable that you will need to find out is
      the duration of your DMD presentation(s).  Some Presentations may be
      a slideshow of images and some may contain videos.  Your will need to
      play each presentation on the DMP to determine the duration length of
      each presentation that you will add to the looped playlist. 
    * Create a Master presentation using DMD. In this presentation, you will
      create add a "Playlist" to the presentation by selecting the Playlist
      button-drop down.  Select "All Media Types" and a Playlist object will
      be added to the Master presentation.
      - Double-click on the object to add content
      - Select "Add URL" button in the Playlist Content window.
      - Fill in the required fields (URL Title & Link) in the "Add URL"
        window.  Repeat the process for each presentation that you want
        to add.
      - Set the Duration for each item in the Playlist. Select the Item
        in the list and then DOUBLE-CLICK on the "Planned Duration"
        field and edit the time to desired duration.  Repeat process for
        each item.
      - Save Master Presentation
    * Schedule or use the  "Actions" drop down on the DMM-DMP Manager screen
      send the Master Presentation to the DMP(s).  The Playlist will play and
      Loop after the last item in the Master Playlist.
    If this answers your question, Please take time to mark this
    discussion answered & rate the response.
    Thank You!
    T.

  • Failed to process JMS message

    Hi,
    While trying to read the message in Queue from my BPEL, Iam getting the following error:
    JMSBC-E0713: Failed to process JMS message [com.stc.jmsjca.core.WTextMessageIn@ffae4c] in onMessage: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    Can any one provide some suggestion on how to resolve this error.

    No, Iam just storing a simple message say "Hello" in the queue, the message is stored in the queue but it is shown in the below format when I opened that file in Notepad:
    UUªª ªªUU ‡ÿãÂ- ‡ 6›4•Z 6›4”öÿ Â
    Ô£9™ÿÿ¬h ÎM o „      fÂ6›4”ñ Trial4 com.sun.messaging.BasicQueue Hai ªªUU
    and soon Iam getting this error below:
    [Fatal Error] :1:1: Content is not allowed in prolog.
    JMSBC-E0713: Failed to process JMS message [com.stc.jmsjca.core.WTextMessageIn@1e377d5] in onMessage: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.

  • IDCS6 MACOSX JS: Data Merging many txt files one after another

    Hello everybody.
    I have a situation where I have to data-merge many text files to the one actual indesign "base" file. The formats of the databases are all the same, the point of difference is a code in the second field of the database that refers to a mailing zone (not a zip/postcode, a "distribution centre" code that has 56 or so possibilities). I would prefer to data merge one file and then somehow split the resulting PDF via Acrobat, but the length of the resulting mailing zones is inconsistent and something that can't be done though the "split document" feature in acrobat.
    The database starts out as one massive file but using a one-line  code, can be split into its mailing zones into separate text files.
    My ultimate question: is there any way to data merge more than one file at once (e.g. one after another) and give them their names based on the names of the input text file?
    Ole Kvern had a script to Data Merge one file without the UI. I have altered the last line slightly so that it outputs to a PDF based on [High Quality Setting]:
    if(app.documents.length != 0){
            var myDocument = app.activeDocument;
            app.dataMergeOptions.removeBlankLines = true;
            //Select a source file.
            var myDataFile = File.openDialog("Select a data file")
            var exported = "file location(redacted for the sake of this post)"
            if(myDataFile != ""){
                    myDocument.dataMergeProperties.selectDataSource(myDataFile,);
                    myDocument.dataMergeProperties.exportFile(exported,"[High Quality Print]",);
    I figure the answer has to do with the variable "myDataFile" and rather than being simply open a dialog, it would be somehow selecting an array of text files, but this is where I am out of my depth.
    Any insights or other thoughts that may not involve trying to do many merges at once but may somehow revolve around one large merged PDF?
    Many thanks
    Colin

    I've answered my own question, but the answer lies outside of Adobe InDesign – it uses bookmarks within Adobe Acrobat.
    1) Data Merge the art/data to one large PDF file.
    2) In the resulting PDF file, manually search out the mailing zones and apply bookmarks to each first instance only of each mailing zone. In this case, it is a manual process of find/replace to find one of 70 possible mailing zones that may be used in any database. Each bookmark should be named with its respective code. It is a manual process, but it would take 5 minutes so this is acceptable.
    3) Using "Split Document" from the pages panel, make sure the "top level bookmarks" radio button is checked, and in the Output Options make sure that the "Use bookmark names for files" radio button is checked.
    I'm aware that this was a rather obscure question that only a fraction of users on this forum may wish to know an answer for, but hopefully this workaround helps someone else in a similar situation.
    Colin

  • Displaying images in canvas one after another

    Hi all,
    I have a problem displaying images in canvas one after another. I am using for loop and when i run the application, all images run back in the and only finally only the last image gets displayed in the emulator. I also used thread.sleep(). But it din't work.
    Here is my code:
    // A canvas that illustrates image drawing
    class DrawImageCanvas extends Canvas
    Image image;
    public void paint(Graphics g)
    int width = getWidth();
    int height = getHeight();
    g.setColor(0);
    g.fillRect(0, 0, width, height);
    String images[]={"paint_2.PNG","radha.PNG","cute.png","design.png","flowers.png"};
    for(int i=0;i<images.length;i++)
    image = null;
    System.out.println("/"+images);
         try
         image = Image.createImage("/"+images[i]);
    catch (IOException ex)
    System.out.println(ex);
    g.setColor(0xffffff);
    g.drawString("Failed to load image!", 0, 0, Graphics.TOP | Graphics.LEFT);
    return;
    if (image != null)
    g.drawImage(image, width/2, height/2, Graphics.VCENTER | Graphics.HCENTER);
    try
    Thread.sleep(5000);
    catch(Exception ex)
         System.out.println("the exception is.."+ex);
    Help me and Thanks in advance.

    See the code below : prefer the use of a Timer and a TimerTask instead of Thread.sleep().
    showNotify (from Canvas) is used to launch the timer.
    import java.io.IOException;
    import java.util.Timer;
    import java.util.TimerTask;
    import javax.microedition.lcdui.Canvas;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    public class DrawImage extends Canvas {
        Image image;
        String images[] = {"img1.png", "img2.png", "img3.png", "img4.png", "img5.png",
                            "img6.png", "img7.png"};
        Image[] tabImage;
        int imageCounter = 0;
        public DrawImage(){
            try {
                tabImage = new Image[images.length];
                for (int i = 0; i < images.length; i++)
                    tabImage[i] = Image.createImage("/" + images);
    } catch (IOException ex) {
    ex.printStackTrace();
    public void paint(Graphics g) {
    int width = getWidth();
    int height = getHeight();
    g.setColor(0);
    g.fillRect(0, 0, width, height);
    image = tabImage[imageCounter];
    if (image != null)
    g.drawImage(image, width / 2, height / 2, Graphics.VCENTER | Graphics.HCENTER);
    else{
    System.out.println("null");
    g.setColor(0xffffff);
    g.drawString("Failed to load image!", 0, 0, Graphics.TOP | Graphics.LEFT);
    protected void showNotify(){
    Timer t = new Timer();
    t.schedule(new PhotoSwitcher(), 5000, 5000);
    private class PhotoSwitcher extends TimerTask{
    public void run() {
    if (imageCounter < images.length - 1)
    imageCounter++;
    else
    imageCounter = 0;
    repaint();
    I hope this will help you !
    fetchy.
    Edited by: fetchy on 14 ao�t 2008 09:48                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Playing movies in Front Row one after another automatically?

    I have a number of short video clips that I can watch with Front Row. However, every time a clip ends, I have to go and click “play” on the next clip and this is annoying. I am wondering if there is a way to make movies play one after another without stopping. Thanks for the help!

    David,
    Thanks for the help. I'm still thinking there must be SOME way to pull this off. It seems like Mac's can do just about anything if you take the time to figure it out. Why wouldn't the people who designed Front Row not add this feature? It doesn't make any sense. There has to be a way. Anybody else have any ideas?

  • How do i play two sound file one after another

    Hi All,
    How do i play two sound file one after another using single AudioClip Component?.
    Advance in thanks
    Manivel

    AudioClip gives you very little control over what happens to the sound, it also isn't capable of playing long clips or waiting until a clip ends. It will play multiple clips over top of each other.
    To do what you want you should use the facilities of javax.sound. Here's a post with an example: http://forum.java.sun.com/thread.jspa?forumID=513&threadID=450768
    There is also a tutorial, but its example fails for long clips.

  • One after another

    Hello,
    SQL> with my_table as
      2             (
      3            select 'M082012' pera, to_number(10584338) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      4            select 'M092012' pera, to_number(15965177) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
      5            select 'M082012' pera, to_number(14254501) snr, to_number(20) pnr, 'Wallen' name, 'Monika' f_name from dual union all
      6            select 'M012013' pera, to_number(14254505) snr, to_number(15) pnr, 'Wallen' name, 'Monika' f_name from dual union all
      7            select 'M012013' pera, to_number(14254506) snr, to_number(15) pnr, 'Wallen' name, 'Monika' f_name from dual union all
      8            select 'M082012' pera, to_number(10584339) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
      9            select 'M092012' pera, to_number(15965178) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all
    10            select 'M012013' pera, to_number(10674833) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
    11            select 'M012013' pera, to_number(10674834) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
    12            select 'M082012' pera, to_number(10674835) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all
    13           select 'M012013' pera, to_number(10539210) snr, to_number(30) pnr, 'Klose' name, 'Werner' f_name from dual union all
    14           select 'M012013' pera, to_number(12345678) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
    15           select 'M012013' pera, to_number(22345789) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
    16           select 'M082012' pera, to_number(10584346) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
    17           select 'M062012' pera, to_number(10550971) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
    18           select 'M092012' pera, to_number(15965185) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all
    19           select 'M082012' pera, to_number(10584352) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all
    20           select 'M092012' pera, to_number(15965191) snr, to_number(80) pnr, 'Duster' name, 'Hucke' f_name from dual)
    21       select case when pera = 'M012013' and rn3 = 1 then '*' end mark,
    22              pera,
    23              snr,
    24              pnr,
    25              name,
    26              f_name,
    27              case when pera = 'M012013' and rn3 = 1 then snr end mark_snr
    28         from (select pera, snr, pnr, name, f_name,
    29                      row_number() over (partition by pera, pnr, snr, name, f_name order by pnr, name) rn,
    30                      row_number() over (partition by pera, name, f_name order by pnr) rn3
    31                 from (select pera, snr, pnr, name, f_name,
    32                              max(case when pera = 'M012013' then 'Y' end)
    33                              over(partition by upper(name||f_name)) m_flag,
    34                              count(*) over(partition by upper(name||f_name)) cnt
    35                         from my_table)
    36                        where m_flag = 'Y'
    37                          and cnt > 1
    38                order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc)
    39       order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc,3
    40  /
    M PERA           SNR        PNR NAME   F_NAME   MARK_SNR
    * M012013   10674833         15 Tester Toni     10674833
      M012013   10674834         15 Tester Toni
      M092012   15965177         15 Tester Toni
      M082012   10674835         15 Tester Toni
    * M012013   14254505         15 Wallen Monika   14254505
      M012013   14254506         15 Wallen Monika
      M082012   14254501         20 Wallen Monika
    * M012013   12345678         50 Meier  Otto     12345678
      M012013   22345789         50 Meier  Otto
      M082012   10584352         50 Meier  Otto
    10 Zeilen ausgewählt.
    SQL>
    SQL> I would like to get the SNR column values one after another in MARK_SNR Column.
    It is possible to get the following output with a sql statement???
    M PERA           SNR        PNR NAME   F_NAME   MARK_SNR
    * M012013   10674833         15 Tester Toni     10674833, 10674834, 15965177, 10674835
    * M012013   14254505         15 Wallen Monika   14254505, 14254506, 14254501
    * M012013   12345678         50 Meier  Otto     12345678, 22345789, 10584352

    Try this:
    WITH my_table AS
            (SELECT 'M082012' pera,
                    TO_NUMBER (10584338) snr,
                    TO_NUMBER (10) pnr,
                    'Beule' name,
                    'Anna' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M092012' pera,
                    TO_NUMBER (15965177) snr,
                    TO_NUMBER (15) pnr,
                    'Tester' name,
                    'Toni' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M082012' pera,
                    TO_NUMBER (14254501) snr,
                    TO_NUMBER (20) pnr,
                    'Wallen' name,
                    'Monika' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M012013' pera,
                    TO_NUMBER (14254505) snr,
                    TO_NUMBER (15) pnr,
                    'Wallen' name,
                    'Monika' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M012013' pera,
                    TO_NUMBER (14254506) snr,
                    TO_NUMBER (15) pnr,
                    'Wallen' name,
                    'Monika' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M082012' pera,
                    TO_NUMBER (10584339) snr,
                    TO_NUMBER (10) pnr,
                    'Beule' name,
                    'Anna' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M092012' pera,
                    TO_NUMBER (15965178) snr,
                    TO_NUMBER (10) pnr,
                    'Beule' name,
                    'Anna' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M012013' pera,
                    TO_NUMBER (10674833) snr,
                    TO_NUMBER (15) pnr,
                    'Tester' name,
                    'Toni' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M012013' pera,
                    TO_NUMBER (10674834) snr,
                    TO_NUMBER (15) pnr,
                    'Tester' name,
                    'Toni' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M082012' pera,
                    TO_NUMBER (10674835) snr,
                    TO_NUMBER (15) pnr,
                    'Tester' name,
                    'Toni' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M012013' pera,
                    TO_NUMBER (10539210) snr,
                    TO_NUMBER (30) pnr,
                    'Klose' name,
                    'Werner' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M012013' pera,
                    TO_NUMBER (12345678) snr,
                    TO_NUMBER (50) pnr,
                    'Meier' name,
                    'Otto' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M012013' pera,
                    TO_NUMBER (22345789) snr,
                    TO_NUMBER (50) pnr,
                    'Meier' name,
                    'Otto' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M082012' pera,
                    TO_NUMBER (10584346) snr,
                    TO_NUMBER (77) pnr,
                    'Carl' name,
                    'Frank' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M062012' pera,
                    TO_NUMBER (10550971) snr,
                    TO_NUMBER (77) pnr,
                    'Carl' name,
                    'Frank' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M092012' pera,
                    TO_NUMBER (15965185) snr,
                    TO_NUMBER (77) pnr,
                    'Carl' name,
                    'Frank' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M082012' pera,
                    TO_NUMBER (10584352) snr,
                    TO_NUMBER (50) pnr,
                    'Meier' name,
                    'Otto' f_name
               FROM DUAL
             UNION ALL
             SELECT 'M092012' pera,
                    TO_NUMBER (15965191) snr,
                    TO_NUMBER (80) pnr,
                    'Duster' name,
                    'Hucke' f_name
               FROM DUAL),
         t AS
            (  SELECT CASE WHEN pera = 'M012013' AND rn3 = 1 THEN '*' END mark,
                      pera,
                      snr,
                      pnr,
                      name,
                      f_name,
                      CASE WHEN pera = 'M012013' AND rn3 = 1 THEN snr END mark_snr
                 FROM (  SELECT pera,
                                snr,
                                pnr,
                                name,
                                f_name,
                                ROW_NUMBER ()
                                OVER (PARTITION BY pera, pnr, snr, name, f_name
                                      ORDER BY pnr, name)
                                   rn,
                                ROW_NUMBER ()
                                OVER (PARTITION BY pera, name, f_name ORDER BY pnr)
                                   rn3
                           FROM (SELECT pera,
                                        snr,
                                        pnr,
                                        name,
                                        f_name,
                                        MAX (CASE WHEN pera = 'M012013' THEN 'Y' END)
                                           OVER (PARTITION BY UPPER (name || f_name))
                                           m_flag,
                                        COUNT (*)
                                           OVER (PARTITION BY UPPER (name || f_name))
                                           cnt
                                   FROM my_table)
                          WHERE m_flag = 'Y' AND cnt > 1
                       ORDER BY 4,
                                5,
                                6,
                                TO_NUMBER (
                                   SUBSTR (pera, 4, 4) || SUBSTR (pera, 2, 2)) DESC)
             ORDER BY 4,
                      5,
                      6,
                      TO_NUMBER (SUBSTR (pera, 4, 4) || SUBSTR (pera, 2, 2)) DESC,
                      3)
    SELECT *
      FROM (SELECT MARK,
                   PERA,
                   SNR,
                   PNR,
                   NAME,
                   a.F_NAME,
                   CASE
                      WHEN mark = '*' THEN
                            MARK_SNR
                         || ','
                         || SUBSTR (b.str, INSTR (b.str, ',', 1) + 1)
                   END
                      mark_snr
              FROM t a,
                   (  SELECT f_name,
                             listagg (SNR, ',') WITHIN GROUP (ORDER BY pera) str
                        FROM t
                    GROUP BY f_name) b
             WHERE a.f_name = b.f_name)
    WHERE mark_snr IS NOT NULL;OUTPUT:
    MARK     PERA     SNR     PNR     NAME     F_NAME     MARK_SNR
    *     M012013     10674833     15     Tester     Toni     10674833,10674834,10674835,15965177
    *     M012013     14254505     15     Wallen     Monika     14254505,14254506,14254501
    *     M012013     12345678     50     Meier     Otto     12345678,22345789,10584352Cheers,
    Manik.

  • Run Jobs One After Another

    I know this is possible, I'm not sure how to go about it using Oracle's Scheduler. I simply want to create a special "queue" that I can submit jobs to which will run one after another. After they run, then then are gone. There many be no jobs at anyone time, and then at other times I may submit 10 jobs to the queue. Currently when I submit jobs they all run parrallel, this is not what I want. I guess I don't understand why Oracle calls it a Job Queue when all my jobs run in parrallel and not in a queue as the name implies.
    This is not say that I don't have other jobs which I would not want to send to this "queue". In other cases I would just want to submit the job and let it run right away and not wait on anything.
    I'm currently using the DBMS_JOB package, which I'm pretty sure won't let me do what I want.
    Any help would be greatly appreciated.
    Thanks,
    Joe

    Here is and example that creates Resource Manager objects and
    two job classes that will permit 1 and 3 jobs to
    run in parallel. Note this will work in 11R1 and 10.2.4
    Assumes user user scott/tiger exists.
    --  Remove existing scheduler objects, jobs and classes
    CONNECT /  as sysdba
    BEGIN
       DBMS_SCHEDULER.DROP_JOB_CLASS(
          JOB_CLASS_NAME => 'JOBQ_WIDTH_1_CLASS'
    END;
    BEGIN
       DBMS_SCHEDULER.DROP_JOB_CLASS(
          JOB_CLASS_NAME => 'JOBQ_WIDTH_3_CLASS'
    END;
    BEGIN
      FOR I IN 1..30 LOOP
      BEGIN
        SYS.DBMS_SCHEDULER.DROP_JOB(JOB_NAME => 'SCOTT.SERIAL_' || I, FORCE=>TRUE);
      EXCEPTION WHEN OTHERS THEN NULL;
      END;
    END LOOP;
    END;
    BEGIN
      FOR I IN 1..90 LOOP
      BEGIN
        SYS.DBMS_SCHEDULER.DROP_JOB(JOB_NAME => 'SCOTT.PAR3_' || I, FORCE=>TRUE);
      EXCEPTION WHEN OTHERS THEN NULL;
      END;
    END LOOP;
    END;
    ALTER SYSTEM SET RESOURCE_MANAGER_PLAN='';
    set echo on
    --  Remove previously defined  resource plan, resource plan
    --  directives, and resource consumer groups  for this test
    BEGIN
        -- Prepare the pending area
        DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA;
        DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA;
        -- Delete resource plan, its resource plan directives, and
        -- any associated resource groups
        DBMS_RESOURCE_MANAGER.DELETE_PLAN_CASCADE(
           plan => 'JOBQS_PLAN'
        -- Submit the changes
        DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA;
        DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA;
    END;
    -- Create resource manager objects
    BEGIN
       DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
       DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
       DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP (
            CONSUMER_GROUP => 'JOBQ_WIDTH_1_GROUP',  
            COMMENT => 'Consumer group to force jobs to execute in serial'
       DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP (
            CONSUMER_GROUP => 'JOBQ_WIDTH_3_GROUP',  
            COMMENT => 'Consumer group to allow jobs to run in parallel 3'
       DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
    END;
    BEGIN
       DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
       DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
       DBMS_RESOURCE_MANAGER.CREATE_PLAN
          ('JOBQS_PLAN', 'PLAN TO SUPPORT JOBQS');
       DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
          PLAN => 'JOBQS_PLAN',
          GROUP_OR_SUBPLAN => 'JOBQ_WIDTH_1_GROUP',
          COMMENT=>'Associates with job class JOBQ_WIDTH_1_CLASS',
          CPU_P1 => 25,
          PARALLEL_DEGREE_LIMIT_P1 => 1,
          ACTIVE_SESS_POOL_P1 =>1
       DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
          PLAN => 'JOBQS_PLAN',
          GROUP_OR_SUBPLAN => 'JOBQ_WIDTH_3_GROUP',
          COMMENT=>'Associates with job class JOBQ_WIDTH_3_CLASS',
          CPU_P1 => 75,
          PARALLEL_DEGREE_LIMIT_P1 => 2,
          ACTIVE_SESS_POOL_P1 =>3
       DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
          PLAN => 'JOBQS_PLAN',
          GROUP_OR_SUBPLAN => 'OTHER_GROUPS',
          CPU_P1 => 0,
          CPU_P2 => 100,
          COMMENT=>'Required'
       DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
       DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
    END;
    -- Create scheduler classes
    BEGIN
       DBMS_SCHEDULER.CREATE_JOB_CLASS(
          JOB_CLASS_NAME => 'JOBQ_WIDTH_1_CLASS',
          LOGGING_LEVEL => DBMS_SCHEDULER.LOGGING_FULL,
          LOG_HISTORY => 5,
          RESOURCE_CONSUMER_GROUP => 'JOBQ_WIDTH_1_GROUP',
          COMMENTS => 'Force jobs to run in serial, through plan JOBQ_PLAN and group JOBQ_WIDTH_1_GROUP'
    END;
    BEGIN
       DBMS_SCHEDULER.CREATE_JOB_CLASS(
          JOB_CLASS_NAME => 'JOBQ_WIDTH_3_CLASS',
          LOGGING_LEVEL => DBMS_SCHEDULER.LOGGING_FULL,
          LOG_HISTORY => 5,
          RESOURCE_CONSUMER_GROUP => 'JOBQ_WIDTH_3_GROUP',
          COMMENTS => 'Allow up to 3 jobs in parallel, enforced by plan JOBQ_PLAN and group JOBQ_WIDTH_3_GROUP'
    END;
    connect / as sysdba
    grant execute on jobq_width_1_class to scott;
    grant execute on jobq_width_3_class to scott;
    begin
      dbms_resource_manager_privs.grant_switch_consumer_group('scott','JOBQ_WIDTH_1_GROUP',false);
      dbms_resource_manager_privs.grant_switch_consumer_group('scott','JOBQ_WIDTH_3_GROUP',false);
    end;
    alter system set resource_manager_plan='';
    connect scott/tiger
    begin
      for i in 1..30 loop
      sys.dbms_scheduler.create_job(job_name => 'scott.serial_' || i,
          job_type=>'plsql_block', job_action=>'dbms_lock.sleep(2);',
          job_class=>'jobq_width_1_class',
          enabled=>true);
      end loop;
    end;
    begin
      for i in 1..90 loop
      sys.dbms_scheduler.create_job(job_name => 'scott.par3_' || i,
          job_type=>'plsql_block', job_action=>'dbms_lock.sleep(2);',
          job_class=>'jobq_width_3_class',
          enabled=>true);
      end loop;
    end;
    /-- The par3_90 job should finish about the same time as the serial_30 job since
    -- we run 3 jobs in paralled and serial respectively.
    -- check user_scheduler_job_run_details for after the test completed to verify.

  • Invoking 2 SQL statements one after another?

    Hi,
    Is it a good idea to invoke to 2 SQL statements one after another using the same connection & statement object? Some thing like this:-
    method(){
    String insertSql="insert into employee(Name,Age)values(?,?);
    Connection conn=null;
    PreparedStatement pst=null;
    int insertRows=0;
    ResultSet rs=null;
    try{
    conn=getConnection(); //will get the connection object
    if(insertRows==0){
    pst=conn.preparedStatement(insertSql);
    pst.setString(1,"Jason");
    pst.setString(2,"30");
    insertRows=pst.executeUpdate();
    conn.commit();
    if(insertRows>0) {
    pst=conn.createStatement("select * from employee");
    //retrieving the data from the same table
    rs=pst.executeQuery();
    while(rs.next()){
    System.out.println("The name is::"+rs.getString(1)+ " "+rs.getString(2));
    }catch(Exception e){
    }finally{
    try{
    if(pst != null) {
    pst.close();
    pst = null;
    if(rs != null) {
    rs.close();
    rs = null;
    if(conn != null) {
    conn.close();
    conn = null;
    }catch(Exception e) {
    e.printStackTrace();
    Here one more thing is that i want the insertSQL statement to be invoked only once that is in the beginning and the next time the method() is called it should skip the insert block and should only retrieve the data using "select * from employee". How to do it? I tried with few options nothing works.. Please do provide a solution for this... It is really urgent.
    Thanks

    Is it a good idea to invoke to 2 SQL statements one after another using the same connection & statement object? I think what you're asking is if you need a new Connection and/or Statement object for every query. The answer is no. In fact, most applications pool Connections so literally thousands or millions of queries are done in the lifetime of a Connection. You can reuse Statements and PreparedStatements as well as long as you intend on executing the same query.

  • Songs Skip Forward One After Another/Sporadic and Out of Nowhere

    I have an older IPOD 40g that skips through songs, one after another, without playing anything, and seems to do it in any mode, especially in overall Shuffle mode. I have the "shuffle Songs" feature on, but other than that, it has a pretty standard set up.
    I have restored to the defaults, last week, and it started doing the wierd stuff again today.
    Sometimes I have a hard time getting it to unfreeze and reset as well.
    I appreciate any help.

    Have you tried Party Shuffle? If you control click on a track, you can choose "Play Next In Party Shuffle". I often listen the way you're describing. I start listening in Party Shuffle (which I have set to select from a specific playlist). When I am reminded of another song, I select the song and then choose Play Next in Party Shuffle. And so on.
    As for your second question, you could try moving your entire short playlist into Party Shuffle. Once that playlist was done, Party Shuffle would revert to it's normal selection criteria (you could set it to pull from your entire library or a specific playlist). Music would keep playing.
    Can you tell I like Party Shuffle?

  • View photos one after another

    I want to be able to go to a tag section and view the photos one after another.  Using Adobe 9 pre and pse.

    Hi,
    I did not completely understand your workflow. Can you please elaborate a bit more?
    Thanks
    Andaleeb

Maybe you are looking for

  • IPod Playlists & Fiat's Blue&Me

    Trying to use my iPod music with Fiat's Blue&Me. First time round would not recognize music (despite converting them all to MP3). After I reformatted the IPod as (shock horror) windows it recognized my music. Problem now is it wont recognise any of m

  • 2.6 won't store presets with catalog

    I have all my presets stored in the same directory along with the catalog. After upgrading to 2.6, the user home directory presets folder is used again and as far as I can tell, the checkbox "store presets with catalog" doesn't have any effect. has a

  • Why does the text size shrink when I make the window smaller?

    I have some notes in a DOCX page.  I don't want the entire page blocking up the desktop yet I want to see the notes.  When I change the size of the page, the text shrinks too.  How useless is that? How to I keep the text normal size and have a smalle

  • Org.apache.jasper.JasperException: Unable to compile class for JSP

    Hi All, I have been using NetBeans IDE 3.5.1. AndI am trying to execute one JSP file, but it is giving error and i am not able to execute the servlet files also in NetBeans IDE. Can anybody help me out regarding this... type - Exception report messag

  • Lenovo IdeaCentre  A720 use as a Touch Monitor 4 a Mac Laptop  - ???

    Hi  I am wanting to purchase an A720 but have two queries I was hoping could be answered before I do. 1) Appreciate the Lenovo is an all in one PC but can it be used as a touch monitor for another pc.  I.e a working touch monitor for a windows 8 lapt