1 2 Previous Next 20 Replies Latest reply on Mar 6, 2007 8:09 AM by tfennelly

    What happened to the custom gateway configuration?

    colsona


      I need to listen for a specific file with no extension. The file is created by a legacy COBOL application and changing its behavior is not an option. I don't see the standard gateway handling this situation. I wrote a custom gateway for it but I can't seem to configure it in anymore.


      Asa

        • 1. Re: What happened to the custom gateway configuration?
          marklittle

          Why do you think the standard gateway won't work? You may be right, but if that's the case it may be worth us looking to address your problem within the system itself.

          • 2. Re: What happened to the custom gateway configuration?
            kurtstam

            You can still plugin in a custom messageCreator. That maybe all you need?

            --Kurt

            • 3. Re: What happened to the custom gateway configuration?

              I think we just need to look into the file processor, ensure it can handle a no extension option, meaning the file does not have to end with any particular string. Maybe an option to process ANY file that gets put into the input dir parameter. I never tested this, it might work already as is.

              • 4. Re: What happened to the custom gateway configuration?
                marklittle

                I agree, though it obviously needs to be handled with care, since you can end up in an infinite loop (as I found at Christmas when "playing around"): process file, put result in same dir, process result, place result.result in same dir ...

                • 5. Re: What happened to the custom gateway configuration?
                  colsona

                  I plan to test the standard gateway with no extension. We didn't want to do a file.listFiles for each poll and then find the file candidate. This is very inefficient as compared to file.exists. I am trying to use the custom composer and I don't seem to have it configured properly. Let me start with what I am trying to accomplish. I want the file poller to detect the file and call my FileEventComposer. My file event composer will rename the file using a GUID and create an ESB message with a file event with the guid filename. I want to send this event through JMS to our application which will have an MDB ready to recieve the message and fire off a jBPM Business Process that will process the file. My current configuration is as follows:


                  <?xml version = "1.0" encoding = "UTF-8"?>
                  <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.xsd" parameterReloadSecs="5">
                  
                   <providers>
                   <fs-provider name="FSprovider1">
                   <fs-bus busid="afmtsifFileChannel" >
                   <fs-message-filter
                   directory="c:\\FileTest\"
                   input-suffix=".txt"
                   work-suffix=".esbWorking"
                   post-delete="false"
                   post-directory="c:\\FileTest\\processed"
                   post-suffix=".sentToEsb"
                   error-delete="false"
                   error-directory="c:\\FileTest\\inError"
                   error-suffix=".IN_ERROR"
                   />
                   </fs-bus>
                   </fs-provider>
                  
                   <jms-provider name="JBossMQ"
                   connection-factory="ConnectionFactory"
                   jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
                   jndi-URL="localhost" >
                  
                   <jms-bus busid="fileEventQueue">
                   <jms-message-filter
                   dest-type="QUEUE"
                   dest-name="/queue/fileEventQueueStage"
                   selector="type='fjbkjbjkbkjbb'"/>
                   </jms-bus>
                  
                   </jms-provider>
                  
                   </providers>
                   <services>
                  
                   <service category="FileEvent" name="AFMTSIFFileListener" description="Listneer for AFNTSIF Files" >
                   <listeners>
                   <fs-listener name="FileGateway"
                   busidref="afmtsifFileChannel"
                   maxThreads="1"
                   is-gateway="true"
                   poll-frequency-seconds="10"
                   />
                   <jms-listener name="sendToAbom"
                   busidref="fileEventQueue"
                   maxThreads="1"
                   />
                   </listeners>
                  
                   <actions>
                   <action name="File event composer class"
                   class="com.spss.esb.FileEventComposer"
                   process="createMessage"
                   />
                   </actions>
                   </service>
                   </services>
                  
                  </jbossesb>
                  


                  The custoim composer is as follows:

                  package com.spss.esb;
                  
                  import org.apache.log4j.Logger;
                  import org.jboss.soa.esb.helpers.ConfigTree;
                  import org.jboss.soa.esb.message.Message;
                  import org.jboss.soa.esb.message.format.MessageFactory;
                  import org.jboss.soa.esb.message.format.MessageType;
                  
                  public class FileEventComposer {
                   ConfigTree configTree = null;
                   private Logger logger = Logger.getLogger(FileEventComposer.class);
                  
                   public FileEventComposer(ConfigTree configTree) {
                   this.configTree = configTree;
                   }
                   public Message createMessage(Object event){
                   if(logger.isInfoEnabled()) logger.info("File event composer has recieved event: "+event.toString());
                   Message newMessage = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
                   newMessage.getBody().setContents("Hello World".getBytes());
                   return newMessage;
                   }
                  
                  }
                  
                  


                  I get the following error:

                  2007-03-05 09:00:28,761 ERROR [org.jboss.soa.esb.listeners.message.ActionProcessingPipeline] Premature termination of action process
                  ing pipeline [Ljava.lang.String;@e819a8]. ActionProcessor [com.spss.esb.FileEventComposer] method not found
                  java.lang.NoSuchMethodException: com.spss.esb.FileEventComposer.createMessage(org.jboss.soa.esb.message.Message)
                   at java.lang.Class.getMethod(Class.java:1581)
                   at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.run(ActionProcessingPipeline.java:85)
                   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
                   at java.lang.Thread.run(Thread.java:595)
                  


                  The manual says that composers must take object and return message so the ESB clearly isn't recognizing my configuration as a custom composer. What do I have wrong?



                  • 6. Re: What happened to the custom gateway configuration?
                    colsona

                    I figured out the composer by tracing the connfiguration process. The composer was created and fired by adding it as a property to the listener.

                     <fs-listener name="FileGateway"
                     busidref="afmtsifFileChannel"
                     maxThreads="1"
                     is-gateway="true"
                     poll-frequency-seconds="10"
                     >
                     <property name="composer-class" value="com.spss.esb.FileEventComposer"/>
                     <property name="composer-process" value="createMessage"/>
                     </fs-listener>
                    


                    Asa

                    • 7. Re: What happened to the custom gateway configuration?
                      colsona

                      FYI, I tested with an empty input-suffix and got the following error:

                       ... 116 more
                      Caused by: org.jboss.soa.esb.ConfigurationException: Missing or invalid <inputSuffix> attribute
                       at org.jboss.soa.esb.listeners.ListenerUtil.obtainAtt(ListenerUtil.java:347)
                       at org.jboss.soa.esb.listeners.gateway.AbstractFileGateway.checkMyParms(AbstractFileGateway.java:369)
                       at org.jboss.soa.esb.listeners.gateway.AbstractFileGateway.<init>(AbstractFileGateway.java:83)
                       at org.jboss.soa.esb.listeners.gateway.FileGatewayListener.<init>(FileGatewayListener.java:49)
                       ... 121 more
                      15:31:36,273 INFO [STDOUT] Unexpected exception while instantiating managed instance
                      


                      • 8. Re: What happened to the custom gateway configuration?
                        kurtstam

                        I just looked at the code, and it assumes you have an input-suffix; no 2 ways about it. However it wouldn't be that much work to allow not defining a suffix at all, and have it match all the files in the input directory. We'd have to make sure the output directory is not the same as the input directory.

                        I think it we may want to open a jira on this. Would that solve your issue?

                        --Kurt

                        • 9. Re: What happened to the custom gateway configuration?
                          colsona


                          It looks like the gateways are hard coded.

                           if(listener.getIsGateway()) {
                           listenerNode.setAttribute("gatewayClass", FileGatewayListener.class.getName());
                          
                          

                          This is after all properties are mapped so it doesn't appear that it can be overridden.

                          This presents a problem in that now I can't use the ESB to detect incoming files as I am constrained.

                          Asa


                          • 10. Re: What happened to the custom gateway configuration?
                            colsona


                            I don't have all my file reading requirements yet but this would resolve the one I am working now. My personal opinion is that the ESB should support the ability to gateway to any system and removing the support for custom gateways removes a critical feature for any ESB.

                            Asa

                            • 11. Re: What happened to the custom gateway configuration?
                              kurtstam

                              It's always a battle between ease-of-use and flexibility. In this case I think being able to plug in your own message creator should suffice. For the gateways themselves there are not too many ways you can think of to configure them. So let's see if we simply missed some functionality. If we go this route we can keep the config validated and easier to debug.

                              However feel free to prove me wrong :).

                              • 12. Re: What happened to the custom gateway configuration?
                                colsona



                                One example I can think of not supported yet is the command line interface. Currently we are forking out to run a cobol command as part of our system. This call is an external system interface and to be true to the architecture this external interface should go through the ESB decoupling our application from the methodology of connecting to the external system. This is only one example of unsupported interfaces. Another would be the MQ MQI interface. Many systems won't properly ineract with JMS messages created in MQ JMS this would block this ESB from connecting to a large installed base of systems.

                                But that isn't my worry now. I am only expressing my opinion. What I need now is a solution for my current problem to move this project forward. Please let me know your chosen solution and when it is available.

                                Asa

                                • 13. Re: What happened to the custom gateway configuration?
                                  kurtstam

                                  We're open source and are happy to take things back :). You can track the progress here: http://jira.jboss.com/jira/browse/JBESB-454

                                  • 14. Re: What happened to the custom gateway configuration?
                                    colsona


                                    Thanks,

                                    Asa

                                    1 2 Previous Next