11 Replies Latest reply on Aug 31, 2007 2:21 AM by Robert Hirst

    Flex Message Service with JMS Dynamic Destination

    tt9488
      Any of you folks knows if Flex Message Service supports JMS Dynamic Destinations? From what I have read about Flex Data Service so far indicates that all JMS destinations must be pre-defined in messaging-config.xml file. Our application requires that the destinations be created at runtime and therefore we can not pre-define them in the messaging-config.xml file. I would greatly appriciate any pointer to solve this problem. Sample code would be helpful. Thanks in advance.

      Tam



        • 1. Re: Flex Message Service with JMS Dynamic Destination
          Mete Atamel Level 1
          We do indeed support any dynamic messaging destinations, including those that use JMSAdapter, from LCDS 2.5 onwards. Check out documentation of LCDS 2.5 for Runtime Configuration and you'll see some examples. If not, let me know and I'll try to provide some samples but dynamic messaging destinations that use JMSAdapter is definitely possible with LCDS 2.5 onwards.
          • 2. Re: Flex Message Service with JMS Dynamic Destination
            Robert Hirst Level 1
            Thanks! I'd just come to the forums to try and find an answer that exact problem, and there it was on the first page

            Just a minor query, the example from the Runtime Configuration docs ("Configuring components with a remote object") has a line:

            ns.setSessionTimeout(30);

            I can't see this in the javadocs, so I assume that this changed to setSubscriptionTimeoutMinutes() to more closely match the property from the config files it represents, correct?
            • 3. Re: Flex Message Service with JMS Dynamic Destination
              Mete Atamel Level 1
              That's correct. Session timeout did not really represent what that value was so it was changed, I think in LCDS 2.5.
              • 4. Re: Flex Message Service with JMS Dynamic Destination
                tt9488 Level 1
                We only have FFlex 2.0.1. Can we do this Runtime Configuration with Flex 2.0.1 or we have to purchase LCDS?

                Thanks,
                Tam
                • 5. Re: Flex Message Service with JMS Dynamic Destination
                  Robert Hirst Level 1
                  I'm probably missing something, but how do I set the important config specifically related to JMS, i.e. what appears in the <jms> tag for the xml config?

                  I can see the more generic messaging config options, but I can't find where to set, for instance, the queue JDBC name.
                  • 6. Flex Message Service with JMS Dynamic Destination
                    Robert Hirst Level 1
                    in reply to tt9488:

                    You will not be able to do any JMS with straight Flex 2.0.1, you need FDS or LCDS too. There's a free but limited version of LiveCycle Data Services, single CPU no clustering. Have you purchased Flex Data Services already? If so there may be an upgrade path.

                    edit: and yes, the dynamic config is LCDS only.

                    edit: but the way it's looking to me right now runtime config may not be viable for jms destinations directly, you may need to write an MDB bridge.

                    edit: Figured it out, there were some JMS config classes I'd somehow missed
                    • 7. Re: Flex Message Service with JMS Dynamic Destination
                      Mete Atamel Level 1
                      Hi Robert, can you elaborate further why you think dynamic/runtime messaging destinations using JMSAdapter are not viable?
                      • 8. Re: Flex Message Service with JMS Dynamic Destination
                        tt9488 Level 1
                        In reply to Robert

                        We do have FDS with our Flex 2.0.1. Sorry for the confusion.

                        Thanks,
                        Tam
                        • 9. Re: Flex Message Service with JMS Dynamic Destination
                          tt9488 Level 1
                          I have been searching the internet for how I can set JMS destinations at runtime using LCDS 2.5.1 and still could not find it. I saw the following code in ChatRoomService that allows setting runtime destination:

                          public void createRoom(String id) {

                          if (roomExists(id))
                          {
                          throw new RuntimeException("Room already exists");
                          }

                          // Create a new Message desination dynamically
                          String serviceId = "message-service";

                          MessageBroker broker = MessageBroker.getMessageBroker(null);
                          MessageService service = (MessageService) broker.getService(serviceId);
                          MessageDestination destination = (MessageDestination) service.createDestination(id);

                          destination.addChannel("my-rtmp");

                          ServerSettings serverSettings = new ServerSettings();
                          serverSettings.setMaxCacheSize(1000);
                          serverSettings.setMessageTTL(0);
                          serverSettings.setDurable(false);
                          destination.setServerSettings(serverSettings);

                          if (service.isStarted())
                          {
                          destination.start();
                          }

                          rooms.add(id);
                          }

                          The above code is not for setting JMS destination, isn't it? If it is not, can someone give me some sample code for setting JMS destination at runtime?

                          Thanks,
                          Tam
                          • 10. Re: Flex Message Service with JMS Dynamic Destination
                            tt9488 Level 1
                            What IDE is used for develop LCDS applications? I tried eclipse-3.2.2 with Flex 2.0.1, FDS 2.0.1, and LCDS 2.5.1 plugins and it did not work. And eclipse-3.2.2 with Flex 3 plugin does not seem to have option for me to create new Flex Data Service application. Can someone give my some pointers on this issue?

                            Thanks,
                            Tam
                            • 11. Flex Message Service with JMS Dynamic Destination
                              Robert Hirst Level 1
                              "Hi Robert, can you elaborate further why you think dynamic/runtime messaging destinations using JMSAdapter are not viable?"

                              I edited my post shortly afterwards, see bolded text at the bottom. I'd missed classes related to JMS config classes, I'd been looking at the LCDS integrated messaging classes and assumed these were supposed to be general purpose. I left the original post there since I don't mind people knowing I make mistakes

                              Although.... I still haven't actually got this working yet, and looking again with fresh eyes after a holiday, it looks like the JMSSettings class can only contain 1 destination JNDI name, and only one JMSSettings class can be attached to each JMS adapter.

                              Am I right in saying that this means a separate adapter will need to be created for each temporary topic?

                              Perhaps I'm looking at it wrong, is there another mechanism I've missed besides JNDI which Flex can use to find a JMS topic?

                              @tt9488

                              Did you make your new project with the correct Flex.war file? If you used Peter Martins FDS plugin to create a new LCDS project in eclipse, then ensure that it points to the correct flex.war file, through the settings page (remember you can't change the FDS war location on the new project dialog).

                              If you need to convert an old project, you can the old jars and SWCs from the web-inf and meta-inf folders and extract the new version from flex.war over the top (backup first) then redo your config files using the new config templates in the resource folder of LCDS 2.5.1. It gets really messy depending on how much you've added it may be easier to make a new LCDS project and copy files across to that. This can get pretty tricky.

                              I'm using LCDS 2.5.1 with the FB 2.0.1 plugin for eclipse 3.2.2 and it works a charm, although I so far have only upgraded existing projects to LCDS 2.5.1 and not made any new ones. Currently I'm working mainly with the SQLAssembler, but hopefully I'll be returning to the dynamic JMS before too long.


                              edit:

                              Just been googling and I've seen you got quite a good reply from Jeff Vroom, stating that the best approach might be to translate JMS topics into LCDS subtopics by subclassing.. that would certainly be more efficient than the idea I had when I thought dynamic JMS was not at all viable, that is linking an MDB to the dynamic JMS topic, and using this as a bridge to translate messages to a dynamically created AS/LCDS topic. I'll post an update if I get either approach working.