webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Creating a fibonacci sequence Service Flow

  • 1.  Creating a fibonacci sequence Service Flow

    Posted Fri March 27, 2020 03:47 AM

    Does anybody know how to create a service flow in software ag using fibonacci sequence


    #webMethods-General
    #webMethods
    #Command-Central
    #Integration-Server-and-ESB


  • 2.  RE: Creating a fibonacci sequence Service Flow

    Posted Fri March 27, 2020 02:10 PM

    Hi Ronaldo,

    can you describe in detail what you want to achieve exactly?

    Most likely you will find some helpful services in the IS Built-In-Services Reference.

    Regards,
    Holger


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods
    #Command-Central


  • 3.  RE: Creating a fibonacci sequence Service Flow

    Posted Sun March 29, 2020 08:18 PM

    Hi,
    Refer the services development guide to understand the webMethods flow steps like MAP, INVOKE, REPEAT etc.,

    Here is the java code and corresponding flow service.


    #Integration-Server-and-ESB
    #webMethods
    #Command-Central
    #webMethods-General


  • 4.  RE: Creating a fibonacci sequence Service Flow

    Posted Tue May 18, 2021 01:30 AM

    Hi, im trying to recreate this, but it appears i cant get the same result as yours. Can i get some help?


    #Command-Central
    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: Creating a fibonacci sequence Service Flow

    Posted Fri March 19, 2021 04:52 AM

    hi,

    can anyone tell what should i Enter in input and output section for printing fibonacci series


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB
    #Command-Central


  • 6.  RE: Creating a fibonacci sequence Service Flow

    Posted Fri March 19, 2021 01:58 PM

    Hi Shalloo,

    if necccessary you can set input field to maxNumber to specify how many iterations you want to calculate.

    output will be the list of calculated numbers as shown in the screenshot above.

    previousNumber is initialized to 0 and nextNumber is initialized to 1 in the first step of the flow.
    “maxNumber - 1” is the value for repeatCount on the REPEAT-Step.

    Regards,
    Holger


    #Command-Central
    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 7.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 12:56 AM

    Hi holger, i followed your instructions but it appears that I cant get the same result as I want, may i know how the pipeline is built?


    #Integration-Server-and-ESB
    #Command-Central
    #webMethods
    #webMethods-General


  • 8.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 10:58 AM

    You’ll want to share screen shots or descriptions of the specific help you’re seeking or is not working as expected.


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General
    #Command-Central


  • 9.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 11:48 AM

    This is my output, it kinda works, but didn’t append to toList, and I want to ask, how to set Count on Repeat? I’ve tried “maxNumbers - 1”, “%maxNumbers% - 1” but still doesn’t work


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB
    #Command-Central


  • 10.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 12:11 PM

    you can only use absolute number or pipeline variables in the count property. You need to do add a subtract step prior to the repeat step. This is a good example of where FLOW starts to fall down and personally I would implement this in java.

    We have lots of online training course and a lot of them are free, have a look here

    https://knowledge.softwareag.com/totara/catalog/index.php?cfp_multiselect_platformplatfor_8daf9[]=Integration%20%26%20API&catalog_learning_type_panel[]=course&orderbykey=featured&itemstyle=narrow

    Here on tech forums you could try looking at this article

    The above shows you a good example where a flow service adds value to manage a business integration use case.
    regards,
    John.


    #webMethods-General
    #webMethods
    #Command-Central
    #Integration-Server-and-ESB


  • 11.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 12:27 PM

    so if i insert maxNumber on the Count property, it will work?


    #webMethods-General
    #webMethods
    #Command-Central
    #Integration-Server-and-ESB


  • 12.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 01:07 PM

    I disagree. FLOW is perfectly capable here. One simply needs to know how to configure the steps.


    #webMethods
    #Integration-Server-and-ESB
    #Command-Central
    #webMethods-General


  • 13.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 12:58 PM

    Clean-up your variables at appropriate intervals and see if that helps. Time and again, outdated values cause problems with loop/repeat, because you’re not “resetting” them before the next iteration.

    KM


    #webMethods-General
    #Command-Central
    #Integration-Server-and-ESB
    #webMethods


  • 14.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 12:23 PM

    Hi Ghifari,

    The instructions above were just additional explanations to Mahesh´s service outline how to initialize the variables.
    These are for fibonacci series but not for detecting prime numbers.

    Regards,
    Holger


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB
    #Command-Central


  • 15.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 12:30 PM

    Hi Holger, i also tried to make fibonacci series by looking at this forum, but my result is different with @Mahesh_K_Sreenivas , and I really didn’t know where did I make mistake.

    I’ve just posted my screenshots here, I would be very glad if you spend a time and help me to fix the problem.


    #Command-Central
    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 16.  RE: Creating a fibonacci sequence Service Flow

    Posted Tue May 18, 2021 04:07 AM

    Why not just write a java service and copy paste an example from the web e.g. Java Program to Display Fibonacci Series

    If you are not sure about creating java services, refer to this example I gave for checking for prime numbers.

    regards,
    John.


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods
    #Command-Central


  • 17.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 10:11 AM

    I’m not sure of a “real” case need to create a fibonacci sequence, but perhaps the intent here is to learn how to program in FLOW. Certainly doable as @Mahesh_K_Sreenivas has shared.

    Over the years there have been various threads in the forums about FLOW vs Java. When to which. Pros and cons. Often, people thinking a particular code solution is not doable in FLOW when in fact it is. There are 2 sets of (tongue-in-cheek) principles to consider when creating solutions in IS:

    1. Don’t write it in Java.
    2. Don’t write it in Java.
    3. Don’t write it in Java.

    One might object to that, using “performance” as rationale – which leads to the other principles:

    1. Don’t optimize yet.
    2. Don’t optimize yet.
    3. Don’t optimize yet. (Profile first)

    As noted, lots of FLOW vs. Java discussions on the forums for review. Many good items for consideration. The primary language of IS is FLOW, right?

    Edit: Well, the primary language of IS as a platform is Java. But the primary language for developing solutions on IS is FLOW.


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General
    #Command-Central


  • 18.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 10:31 AM

    yes, my intent here is to learn how to program in flow, as I learned it by myself and I can get a little confused by how it works and how to solve the problem if it occurs


    #Integration-Server-and-ESB
    #Command-Central
    #webMethods
    #webMethods-General


  • 19.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 11:05 AM

    Sorry, I should have realised. However I wouldn’t pick a fibonacci function as an example in order to learn flow. It’s important to realise that flows has it’s strengths and weaknesses and is suitable for certain patterns and not others.

    Flow is great for orchestrating and chaining tasks together, mapping and simple decision making are great in flow. Recursive, complex algorithms, Deep loops and low level data processing (bytes, arrays etc) are not.

    So I would say use use flow for top-level service, mapping etc. but don’t be afraid to use java services for code where flow starts to get in the way rather than accelerate development.

    As a caveat complex java services are a no no too. Write proper java classes, package as a jar and then use the java service as a simple entry point into your java library. Advantage is that it is easy to debug java classes, but not java service,
    regards
    John.


    #webMethods-General
    #Command-Central
    #webMethods
    #Integration-Server-and-ESB


  • 20.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 11:17 AM

    It’s okay John, anyway do you have a good example or resource to learn about flow service? I really want to learn, but it seems webMethods has a little resource for learning


    #webMethods-General
    #webMethods
    #Command-Central
    #Integration-Server-and-ESB


  • 21.  RE: Creating a fibonacci sequence Service Flow

    Posted Wed May 19, 2021 12:23 PM

    The example from @Mahesh_K_Sreenivas is perfectly reasonable, IMO. The comparison is helpful for learning. Certainly other algorithms would be useful as examples too, but this one seems okay to me.

    Reasonable advice.

    It is often the case that the argument for using Java is “when things get complex.” with the view that “FLOW is for simple things.” I usually disagree, to at least some degree. You still have to analyze and design appropriate components.

    When writing FLOW, one must apply structured programming principles. One concept that often gets overlooked is simple modularity (subroutines). FLOW developers too often throw everything into a single FLOW service. It’s like coding everything in main(). Not good. There can also be a tendency to not define inputs/outputs. Also a tendency for “pipeline litter” and an (ill-advised) desire to use clearPipeline. FLOW provides lots of opportunity to shoot yourself in the foot. :slight_smile:

    My guidance, FWIW: use Java for small, focused utilities. IME, creating a library/JAR is a rare need (I can think of only 1 time where we did that; using 3rd-party libraries and hooking them into IS via Java services is also relatively rare but a bit more frequent).

    Another tidbit for consideration: if you’re Java developer, resist the urge to “go with what is familiar” and really strive to learn/understand FLOW. Most of the criticisms about FLOW are from C/C++/C#/Java developers who expect/want FLOW to have all the same behaviors/features of these languages. It doesn’t but it has enough, along with the built-in services and adapters, to do significant, “integration-y” things. :slight_smile:


    #Command-Central
    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB