Topic
  • 8 replies
  • Latest Post - ‏2015-12-31T13:55:20Z by RichMcFate
sunil0548
sunil0548
16 Posts

Pinned topic Wire Adapter using PUT function in WTX

‏2013-09-28T09:01:56Z |

Hi anyone briefly explain me how WIRE adapter can be used using PUT function while configured with WMB.

  • paul.brett
    paul.brett
    761 Posts
    ACCEPTED ANSWER

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-30T09:11:31Z  

    I enclose an example that uses the PUT() function and the WIRE adapter.  The next node is a Java Compute Node, and I have limited Java skills.

    I wrote out (in append mode) to a file ('WritingToFile.out'):

    +---------- Begin log entry ----------+
    Now=Wed Dec 30 09:07:06 GMT 2015MbMessageAssembly
    (
      Message:
        com.ibm.broker.plugin.MbMessage@43614361
    
      Local environment:
        com.ibm.broker.plugin.MbMessage@507a507a
    
      Global environment:
        com.ibm.broker.plugin.MbMessage@51935193
    
      Exception list:
        com.ibm.broker.plugin.MbMessage@52df52df
    )
    +---------- End log entry   ----------+
    

    Obviously, a proper Java programmer could do a lot more with the message stream.

    Thank-you.

    Paul

    Follow me on Twitter

    Attachments

  • paul.brett
    paul.brett
    761 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2013-10-10T12:09:50Z  

    In the map, you would use the syntax as follows:

    
    
    
    =PUT("
    WIRE", "
    output_terminal_name",
    data)
    

    Optionally, you can specify that the message is to be sent immediately. The -NOW argument sends the message to the output terminal as soon as the PUT rule is processed. When you omit the -NOW argument, a map primitive sends the data to the output terminal when the map completes, and a RUN map sends a message to the output terminal when the top map completes. If you omit the -NOW argument and the map or RUN map fails, the message is not sent.

    
    
    
    =PUT("
    WIRE", "
    output_terminal_name -NOW",
    data)
    

     

    (from http://pic.dhe.ibm.com/infocenter/wtxdoc/v8r4m0/topic/com.ibm.websphere.dtx.wtx4esb.doc/references/r_wtx4esb_put_rule_syntax.htm?resultof=%22%77%69%72%65%22%20%22%61%64%61%70%74%65%72%22%20%22%61%64%61%70%74%22%20)

     

    Then in the Toolkit, you right-click the output terminals of the map node, and choose 'Add Outut Terminal' from the pop-up menu.  You name this new terminal to match the rule (output_terminal_name above).

     

    After that, all you need to do is wire this new output terminal as you would any other output terminal.

     

    Thank-you.

    Paul

    Follow me on Twitter

  • IBMDEVELOPER
    IBMDEVELOPER
    4 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-29T17:20:39Z  

    In the map, you would use the syntax as follows:

    <pre class="pre codeblock" dir="ltr"> =PUT(" WIRE", " output_terminal_name", data) </pre>

    Optionally, you can specify that the message is to be sent immediately. The -NOW argument sends the message to the output terminal as soon as the PUT rule is processed. When you omit the -NOW argument, a map primitive sends the data to the output terminal when the map completes, and a RUN map sends a message to the output terminal when the top map completes. If you omit the -NOW argument and the map or RUN map fails, the message is not sent.

    <pre class="pre codeblock" dir="ltr"> =PUT(" WIRE", " output_terminal_name -NOW", data) </pre>

     

    (from http://pic.dhe.ibm.com/infocenter/wtxdoc/v8r4m0/topic/com.ibm.websphere.dtx.wtx4esb.doc/references/r_wtx4esb_put_rule_syntax.htm?resultof=%22%77%69%72%65%22%20%22%61%64%61%70%74%65%72%22%20%22%61%64%61%70%74%22%20)

     

    Then in the Toolkit, you right-click the output terminals of the map node, and choose 'Add Outut Terminal' from the pop-up menu.  You name this new terminal to match the rule (output_terminal_name above).

     

    After that, all you need to do is wire this new output terminal as you would any other output terminal.

     

    Thank-you.

    Paul

    Follow me on Twitter

    Hi Paul,

     

    How can we get the data from PUTWIRE card to java?

    I have to get the out data as a stream of bytes from Putwire card that need to be written to a output file in java code.

     

    Thanks,

  • paul.brett
    paul.brett
    761 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-30T09:11:31Z  

    I enclose an example that uses the PUT() function and the WIRE adapter.  The next node is a Java Compute Node, and I have limited Java skills.

    I wrote out (in append mode) to a file ('WritingToFile.out'):

    +---------- Begin log entry ----------+
    Now=Wed Dec 30 09:07:06 GMT 2015MbMessageAssembly
    (
      Message:
        com.ibm.broker.plugin.MbMessage@43614361
    
      Local environment:
        com.ibm.broker.plugin.MbMessage@507a507a
    
      Global environment:
        com.ibm.broker.plugin.MbMessage@51935193
    
      Exception list:
        com.ibm.broker.plugin.MbMessage@52df52df
    )
    +---------- End log entry   ----------+
    

    Obviously, a proper Java programmer could do a lot more with the message stream.

    Thank-you.

    Paul

    Follow me on Twitter

    Attachments

  • IBMDEVELOPER
    IBMDEVELOPER
    4 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-30T14:20:59Z  

    I enclose an example that uses the PUT() function and the WIRE adapter.  The next node is a Java Compute Node, and I have limited Java skills.

    I wrote out (in append mode) to a file ('WritingToFile.out'):

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">+---------- Begin log entry ----------+ Now=Wed Dec 30 09:07:06 GMT 2015MbMessageAssembly ( Message: com.ibm.broker.plugin.MbMessage@43614361 Local environment: com.ibm.broker.plugin.MbMessage@507a507a Global environment: com.ibm.broker.plugin.MbMessage@51935193 Exception list: com.ibm.broker.plugin.MbMessage@52df52df ) +---------- End log entry ----------+ </pre>

    Obviously, a proper Java programmer could do a lot more with the message stream.

    Thank-you.

    Paul

    Follow me on Twitter

    Hello Paul,

     

    Thanks for the quick reply.

    Here I am attaching you the java code that takes the input from a file system and pass it to the map(.mmc) , execute the .mmc map and returns the output to the java program. Now the java program writes the output data to a file system. 

    Problem with this is, when i am giving the main outcard number(ex. 1) it is fetching the data.When i am giving the putwire card number(ex. 2) , it unable to fetch the data. Because it unable to get the data through PUT function.(=PUT("FILE","wtxout",CTEXT(Output2,"Native"))).

     

    Can you give any suggestion??

    Attachments

  • paul.brett
    paul.brett
    761 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-30T15:09:52Z  

    This code indicates that you are calling a WTX map using the Java API, and not using the WebSphere TX Node in WebSphere Message Broker at all.

    Did you import my project?  Do you have the IBM WebSphere TX for Integration Servers embedded in your WMB Toolkit?

    If you are seeking assistance with using the WIRE adapter to send a data stream back to a calling Java program, then I am sorry to report that this cannot be done.  The WIRE adapter can ONLY be used when the map is called from the WTX Node.

    Thank-you.

    Paul

    Follow me on Twitter

  • IBMDEVELOPER
    IBMDEVELOPER
    4 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-30T16:04:23Z  

    This code indicates that you are calling a WTX map using the Java API, and not using the WebSphere TX Node in WebSphere Message Broker at all.

    Did you import my project?  Do you have the IBM WebSphere TX for Integration Servers embedded in your WMB Toolkit?

    If you are seeking assistance with using the WIRE adapter to send a data stream back to a calling Java program, then I am sorry to report that this cannot be done.  The WIRE adapter can ONLY be used when the map is called from the WTX Node.

    Thank-you.

    Paul

    Follow me on Twitter

    Hello Paul,

     

    yes, I am not using any WMB technology. I have integrated the WTX with Java API without any other technologies.(No IIB/WMB)

    Atcually, in java code getoutputobject(1) , we need to specify the outcard number to get the data. but as per java perspective we dont know which card is the main outcard? 

    we can know how many outcards present and for the particular card number the data can be fetched.

     

    So, you are saying that this cannot be done through PUT function?

  • paul.brett
    paul.brett
    761 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-30T18:15:21Z  

    I do not believe this is possible.  For a more complete answer, including some workaround suggestions, please could you raise a Service Request with IBM?

    Thank-you.

    Paul

    Follow me on Twitter

  • RichMcFate
    RichMcFate
    37 Posts

    Re: Wire Adapter using PUT function in WTX

    ‏2015-12-31T13:55:20Z  

    Hello Paul,

     

    yes, I am not using any WMB technology. I have integrated the WTX with Java API without any other technologies.(No IIB/WMB)

    Atcually, in java code getoutputobject(1) , we need to specify the outcard number to get the data. but as per java perspective we dont know which card is the main outcard? 

    we can know how many outcards present and for the particular card number the data can be fetched.

     

    So, you are saying that this cannot be done through PUT function?

    Two questions:

     

    1. If all you're going to do with the data is write it to a file, why not just let WTX do it?  Why do you need to bring it back to the calling code at all?  You could certainly pass in the name of the file you want to create.

     

    2. Have you looked at the java class adapter?  You can invoke any public method.  Perhaps you can encapsulate your 'file writer' code into a public method and invoke it directly from the map using the PUT("JAVA"..

     

    Documentation is here:

    http://www-01.ibm.com/support/knowledgecenter/SSVSD8_8.4.1/com.ibm.websphere.dtx.adapjavcls.doc/concepts/c_java_Overview_.htm