How to detect 'publisher gone away'

I've written a simple publish/subscribe solution using a topic as opposed to a queue paradigm. I start the server, establish a JMS destination, etc., etc., then start the client last (of course). All is well.
Now imagine the server gets stopped for some reason. The client carries on regardless. The problem, though, is that when the server restarts, if it tries sending a message to the client, the client never receives it - presumably because the publish/subscribe connection has been lost ??
Is there a simple way (code snippet ?) of the client detecting that it has lost the connection to the publisher it originally connected to ? Some sort of polling mechanism in a separate thread perhaps ?
Gary Roussak

Thanks all for your attention so far - but I'm still struggling.
I certainly believe all the advice you are generously giving me at the moment, but am not sure how it is relevant to me. I am sure I'm probably being stupid here - but as I say, I'm unfamiliar with the real innards of JMS.
Can I ask you to bear with me whilst I try again to explain the detail of my problem ? And, by the way, the problem is not necessarily about detecting that the JMS provider has gone away, but in getting the subscriber to re-connect successfully.
My JMS provider is J2EE itself, i.e. I'm using J2EE 1.3.1 which has its own classes to implement the JMS API.
My solution is extremely unsophisticated at this stage, based as it is on the SimpleTopicPublisher/SimpleTopicSubscriber example code in a JMS tutorial from earlier this year.
I start the J2EE server and then create a 'Topic' (e.g. 'MyTopic').
I now run up the Publisher client I've created. Think of it as a basic Swing GUI which allows the operator to write a message and transmit it. The Publisher does the usual stuff: establish initial context, establish topic conn factory, lookup the topic name, create connection, create session, create publisher, start connection. And then it sits there waiting for an operator to publish. It is coded to properly clear up all JMS resources when it exits.
Next I run up the Subscriber client. It sits invisibly in the background. Set up is a mirror image of the Publisher except of course it creates a subscriber object instead of a publisher object. And that's it - it idles, waiting for onMessage() to be called. The connection is left permanently started. The only extra is this: instead of using your onException() approach, every five seconds, my Subscriber loops around testing to see if it can still get an initial context and then a factory object - temporary ones, not the same as the ones I've already instantiated. Yes - I know this is a horrible way to do it - but it's all I could think of before you told me about onException(). Let's refer to it as my 'test loop'. If it passes, I know everything is OK, if it fails, I know something has gone wrong. And as far as that goes, it DOES work.
I now publish a message and the Subscriber gets it. No problems.
OK. I now quit my Publisher. The test loop in the Subscriber doesn't fail, but that's not a problem because, if I restart my Publisher some seconds or minutes later and try to publish a message, the Subscriber gets it. So I can suffer the Publisher going down without any impact at all on the Subscriber.
I now quit my Publisher. But then I also follow that with a 'j2ee stop' as well so as to simulate the J2EE server box suffering a major problem. The test loop in the Subscriber now fails: it establishes initial context, but fails to establish a factory. Quite understandable. In the meantime, the test loop continues going round every 5 seconds, trying to set up a new initial context, factory, topic, connection, session, etc. And, whilst J2EE remains down, the loop repeatedly fails. Just what I wanted.
Now I restart J2EE (and also start my Publisher client again). However, the test loop in the Subscriber never recovers, i.e. it always establishes initial context, but never re-instantiates a factory object (and thus cannot do the remaining setup steps either, thus it never receives any more published messages of course). And I can't understand why this is the case - why shouldn't the test loop recover fully if I'm doing all the setup steps again ? If I start a brand new Subscriber client process, it works fine. But what's the difference ? New process id ? new threads ? Am I trying to do something that would not be expected to work ? Why ?
And why is this approach important to me ? Because the user whose PC is running the Subscriber client should not be expected to monitor the health of the client. If the client dies, software should be able automate its restart.
Does this explain the situation more ?

Similar Messages

  • HT1386 I have been trying to sync my iPhone and its not syncing. I've synced it before but now it has gone away. How can I re-sync it? Please help.

    I have been trying to sync my iPhone and its not syncing. I've synced it before but now it has gone away. How can I re-sync it? Please help.

    you did enable Music syncing in iTunes, yes?

  • This is a silly question, but I cannot fix it! The icons that appear on my photos after I edit them, have gone away. The only way I can see them is in the Grid view. How can I get the icons back on the thumbnail photos of the full gallery that is loaded?

    This is a silly question, but I cannot fix it! The icons that appear on my photos after I edit them, have gone away. The only way I can see them is in the Grid view.
    How can I get the icons back on the thumbnail photos of the full gallery that is loaded? TIA =)

    You have likely dragged the size of the filmstrip thumbnails to a small size that prevents Lightroom from displaying the badges. Using your mouse, mouse over the top line of the filmstrip and then drag it supports to increase the size.

  • How can I publish an App to a selceted group of people without using the Adobe Contetn Viewer?

    How can I publish an App to a selected group of people ( not via App Store) without using the Adobe Content Viewer?
    The App was developed with InDesign 6.0

    You'd have to sign up for an Apple Developer account and then gather all the UDID's (Apple limits this to only 100 devices) that you want your app to be installed on. Create your mobile provisioning profiles to include these ID's and then you could use TestFlight to push out your app and monitor who has installed it. Of course Testflight is intended for monitoring your apps performance but I'm sure you can get away with it if you use it to push you app. One thing to keep in mind is the mobile provisoning profiles are only valid for 1 year. Hope this helps.

  • How do i publish to the web page?

    i put lion server on my MB Pro.  It's up.  When I http to the IP address, I get the default web page. my question is how do I publish to this web site?  I've tried FTP access and it doesn't look like that's supported.  I tried opening the site with dreamweaver and no joy.
    I'd like to just create a web page and publish it to the mac server but i don't know how.
    i guess I could create a web page in iweb and publish it to the sites\default but I was wanting to do it from a remote location.  is that doable?
    thanks
    cliff

    I suggest you upgrade to the latest iWeb version while copies are still availalbe: iLife '11 - Apple Store (U.S.).  That's because it's now confirmed that iWeb and iDVD have been discontinued by Apple. This is evidenced by the fact that new Macs are shipping with iLife 11 installed but without iWeb and iDVD.
    On June 30, 2012 MobileMe will be shutdown. HOWEVER, iWeb will still continue to work but without the following:
    Features No Longer Available Once MobileMe is Discontinued:
    ◼ Password protection
    ◼ Blog and photo comments
    ◼ Blog search
    ◼ Hit counter
    ◼ MobileMe Gallery
    All of these features can be replaced with 3rd party options.
    I found that if I published my site to a folder on my hard drive and then uploaded with a 3rd party FTP client subscriptions to slideshows and the RSS feed were broken.  If I published directly from iWeb to the FPT server those two features continued to work correctly.
    There's another problem and that's with iWeb's popup slideshows.  Once the MMe servers are no longer online the popup slideshow buttons will not display their images.
    Click to view full size
    However, Roddy McKay and I have figured out a way to modify existing sites with those slideshows and iWeb itself so that those images will display as expected once MobileMe servers are gone.  How to is described in this tutorial: #26 - How to Modify iWeb So Popup Slideshows Will Work After MobileMe is Discontinued.
    In addition the iLife suite of applications offered on disc is now a discontinued product and the remaining supported iApps will only be available thru the App Store from now on.
    HOWEVER, the iLife 11 boxed version that is still currently available at the online Apple Store (Store button at the top of the page) and those copies still on the shelves of retailers will include iWeb and iDVD.
    This also may be of some interest to you: Life After MobileMe.
    OT

  • HS ODBC GONE AWAY ON BIG TABLE QRY

    Hello,
    I have an HS ODBC connection set up pointing to a MySQL 5.0 database on Windows using mysql odbc 3.51.12. Oracle XE is on the same box and tnsames, sqlnet.ora, and HS ok is all set up.
    The problem is I have a huge table 100 mill rows, in MySQL, and when I run a query in Oracle SQL Developer it runs for about two minutes then I get errrors ORA-00942 lost connection, or gone away.
    I can run a query against a smaller table in the schema and it returns rows quickly. So I know the HS ODBC connection is working.
    I noticed the HS service running on Windows starts up and uses 1.5 gig of memory and the CPU time maxes to 95%, on the big table query, then the connection drops.
    Any advice on what to do here. There doesn't seem to be any config settings with HS service to limit or increase the rows, or increase the cache.
    MySQL does have some advanced ODBC driver options that I will try.
    Does anyone have any suggestions on how to handle this overloading problem??
    Thanks for the help,

    FYI, HS is Oracle Hetrogenous service to connect to non-oracle databases.
    I actually found a workaround. The table is so large the query crashes. So I broke table up with 5 MySql views, and now am able to query the views using select insert Oracle stored procedure into Oracle table.

  • I have a cirkel with a lock up in rigth corner,what is it,and how can i take it away?

    I have a cirkel with a lock,up in rigth corner of my Iphone.What is that and how can I take it away?

    Double click the home button, swipe to the right until you see the play controls for music, right next to it is the icon for the screen orientation lock. Tap on it to unlock the screen again, your icon in the right corner will be gone.
    tap on the home button to close the multitask bar again.
    Message was edited by: Ingo2711

  • Custom Component : How to detect what charset the request used?

    I want to write a file upload component, this component must use the same charset as the request used to decode file name from data post from web browser, How to detect what charset the request used?

    Hi Eddie,
    As Arjit suggested, there are a bunch of functions available in WEBI like GetDominantPreferredViewingLocale(), GetLocale() and GetPreferredViewingLocale(), etc. that you could use.
    There are no such specific functions provided within Dashboards tool.
    So, you can create a WEBI report, and have one of these formulas specified in a variable in the webi report. Then, have the block published as a BIWS and use this BIWS in your dashboard.

  • How can I Publish to a Folder just one of the several websites I have created using iWeb?

    How can I Publish to a Folder just one of the several websites I have created using iWeb?
    it drives me nuts having to emove all the other websites when I want to upload one. 
    Sparrow

    For iWeb, I like to do only one site per domain file.  I move domain files out of the Application Support folder and place them inside project or client folders, or in DropBox. Once you duplicate a domain file and begin customizing it, it will load and behave as a separate project/site.
    I publish each iWeb domain/project direct to a server via FTP. Sometime I publish to a folder, then upload via FTP manually.
    iWeb is a remarkable tool, especially when you work from scratch with blank tamplates
    Here are a few of my iWeb sites:
    http://www.newcovenant.org
    http://www.visionmultimedia.org
    http://www.visioncomsolutions.com

  • How can I publish photos to more than one Facebook account?

    How can I publish photos from iphoto to more than one Facebook account?  Another way to ask is how to add a second Facebook account to the account list in iphoto?

    Open iPhoto Preferences, click on the "Accounts" icon, and add another account.

  • How can I publish as an exe that will play in Windows 98?

    I work in the art department of a documentary series and I have a Dell Iinspiron 3200 running Windows 98 (with Flashplayer 9) that I need to use to run animations that I made on a seperate machine running CS5. How should I publish them so that they can be played on the laptop? When I bring the files over, they are recognized as flash applications (the icon is right) but trying to play them results in two errors: "(directory) file expects a newer version of windows. Upgrade your Windows version" and "(directory) a device attached to the system is not functioning"
    I have tried publishing as version 9, but the fies still won't run, and examining the properties of them reveals a file version of 10.1.
    How can I get this to work?
    Thanks in advance

    PS: Further investigation has brought up the possibility that it may work better if I rewrote it in as2. Apparently as3 may not be able to write back to older versions...can anyone perhaps confirm or refute that before I restart the project?

  • HOW CAN I Publish ALL the Original Different Colors in iCal

    I am trying to publish a grouped calendar which includes several differently colored events. I am testing it by subscribing to it from an iCal that has no calendars created at all....and it still will not publish the different colors of the original calendar. All the events appear as one color.
    How can I publish/share my calendar and have ALL the different colors show?
    -I am publishing using a .Mac account.
    THANKS VERY MUCH for any help anyone can give! It will be hugely appreciated.

    I am having this same trouble - I publish
    webcal://ical.mac.com/neyt/neyt.ics
    as a grouped calendar. I tried resetting my sync data fromthe computer that this calendar lives on ( OSX 10.4 because I realized earlier versions have Ical that doesn't even group..)
    Now when I have a subscriber pull down the .ics file, it doesn't show up as grouped, nor do the groups live onthe website version.
    why don't these groups just show up? if I send people the .ics file - it all works just fine...
    I know that some colors might be in use on other computers, I'm sure that other colors will be assigned s individuals need them in their calendars, but the groupings should sync...
    help!!
    flipster for G.Stockman

  • How can I publish just ONE site

    Everytime I create a new site and publish it to a folder (to place in my own domain) iWeb publishes ALL of the sites every time, no matter whether changes have been made to any site or not.
    How do I publish just ONE site?
    If I get mobile.me, will I be able to publish just the ONE site I wish to publish?
    Phil

    I use iWebSites to manage multiple sites.. It lets me create multiple sites and multiple domain files.
    If you have multiple sites in one domain file here's the workflow I used to split them into individual site files with iWebSites. Be sure to make a backup copy of your original Domain.sites files before starting the splitting process.
    This lets me edit several sites and only republish the one I want.
    OT

  • How can I publish a project so that the link to embedded flv is not lost?

    When publishing an Adobe Captivate 3 project, the embedded flv file does not play.
    How can I publish a project so that the link to embedded flv is not lost?

    I am not really sure, if I understand you right. But try this:
    Don’t place a picture, but draw a box and use the "Fill" command to put a picture into it.
    (Don’t click onto the color swatch, but onto the blue link "Fill".)
    In this case responsivness should work.

  • How to detect USB Flash Drive name in LabVIEW

    Hi there
    I was looking for how to detect a USB Flash Drive name in Labview
    appearently every time i insert USB Flash Drive in a computer, windows assign it a different name
    once "J:" and sometimes "M:"
    Is there anyway to obtain USB Flash Drive name programmatically in Labview ?
    Because in my program an user shouldn't be able to access HDD Drives except his USB Flash Drive (for inserting some file ...)
    thank you and excuse me for my poor english 

    I was able to get the demo.vi to load, but it could not load the other two because there is no block diagram associated with those.  I'm not sure why this is.  I haven't had any issues with other llbs before.
    Reese, (former CLAD, future CLD)
    Some people call me the Space Cowboy!
    Some call me the gangster of love.
    Some people call me MoReese!
    ...I'm right here baby, right here, right here, right here at home

Maybe you are looking for