14 Replies Latest reply on Oct 10, 2015 3:07 AM by zhfeng

    Hit Blacktie servers by webservice

    joicejoy

      Need to hit Blacktie servers using a webclient. Is there any quickstart for this.

        • 1. Re: Hit Blacktie servers by webservice
          tomjenkinson

          Unfortunately not. Are you trying to coordinate updates to multiple XATMI services in one transaction from the same webclient?

           

          I.e. webclient begin transaction

          webclient call XATMI1

          webclient call XATMI2

          webclient commit

           

          or just webclient begin

          webclient call XATMI1

          XATMI1 call XATMI2

          webclient commit?

           

          If its the former, there is likely some functionality not available to support this on BlackTie side as it requires bridging XTS, if its the latter the setup would be.

           

          1. Create a normal webservice with an API

          2. Create XATMI service

          3. Deploy webservice on WildFly

          4. Use jatmibroker api in normal webservice to begin/commit a transaction (if desirable) and call XATMI C services

           

          Its a very interesting and advanced topic - thanks for your continued interest in Narayana!

          • 2. Re: Hit Blacktie servers by webservice
            joicejoy

            In Tuxedo, we have the facility to mark the beginning of a transaction by calling tpbegin() and end the transaction by calling tpcommit()

            Every api call (tpcall) in between is part of that transaction and managed by Tuxedo especially if failure occurs and rollback is needed.

             

            Can you confirm if this is possible.

            • 3. Re: Hit Blacktie servers by webservice
              tomjenkinson

              In BlackTie we use the APIs defined in the open standard tx.h and xatmi.h so that is tx_begin and tx_commit. Even then, the transaction can't be propagated to a webservice as we don't have the bridging for that in place (though we could add it as we do have bridging, just not for BlackTie).

               

              e.g.

              tx_begin //narayana/tx.h at master · jbosstm/narayana · GitHub

              tpcall("A"... //narayana/xatmi.h at master · jbosstm/narayana · GitHub

              tpcall("B"...

              tx_commit()

              • 4. Re: Hit Blacktie servers by webservice
                joicejoy

                Which type of clients for Blacktie support this feature currently.

                • 5. Re: Hit Blacktie servers by webservice
                  tomjenkinson

                  Java (inside WildFly) and C (standalone). Transaction is propagated on pertinent tp* call.

                  • 6. Re: Hit Blacktie servers by webservice
                    joicejoy

                    Are there any quickstarts for Java (inside Wildfly) client API calls.

                     

                    Also if we use C(standalone) clients, how the requests routed to different servers.

                     

                    In Tuxedo we have a BBL process which routes the requests. In addition to this, it provides addtional features like Content Based Routing and Load Balancing etc.

                     

                    Can we have multiple instances of the same server. If yes, how is load balancing handled. Is it through Wildfly?

                     

                    Could you explain the role of Wildfly in this Blacktie based solution.

                    • 7. Re: Hit Blacktie servers by webservice
                      tomjenkinson

                      Joice Joy wrote:

                       

                      Are there any quickstarts for Java (inside Wildfly) client API calls.

                       

                      https://github.com/jbosstm/quickstart/tree/master/blacktie/jatmibroker-xatmi/mdb-xatmi-service

                       

                      Joice Joy wrote:

                       

                      Also if we use C(standalone) clients, how the requests routed to different servers.

                       

                      In Tuxedo we have a BBL process which routes the requests. In addition to this, it provides addtional features like Content Based Routing and Load Balancing etc.

                       

                      Can we have multiple instances of the same server. If yes, how is load balancing handled. Is it through Wildfly?

                       

                      Could you explain the role of Wildfly in this Blacktie based solution.

                      WildFly hosts the message broker which is where the load balancing is done. You can run multiple copies of the same server. You can see here that two copies of fooapp server are ran: https://github.com/jbosstm/quickstart/blob/master/blacktie/xatmi/fooapp/btconfig.xml#L28

                       

                      Loadbalancing is done via the message broker.

                       

                      WildFly provides the actual transaction manager, plus the message broker for load balancing.

                      • 8. Re: Hit Blacktie servers by webservice
                        joicejoy

                        Thanks for the reply.

                         

                        I see the quickstart still uses hornetq. Do you think it will still work?

                        • 9. Re: Hit Blacktie servers by webservice
                          tomjenkinson

                          Yes, it is tested in CI. It might say hornetq somewhere (please raise a Jira or let us know on here) but it is using Artemis.

                          • 11. Re: Hit Blacktie servers by webservice
                            joicejoy

                            Thanks for the reply.

                             

                            I have another question regarding service names. In Tuxedo the advertised service names are mapped to actual function names which will be called.

                             

                            Tuxedo limits the names of the advertised services to 15 characters whereas the actual function names which are called have a limit of 127.

                             

                            I see in Blacktie the name of the service advertised is the name of the function that is called.

                             

                            So what are the limits on service names in Blacktie.

                            • 12. Re: Hit Blacktie servers by webservice
                              tomjenkinson

                              Hi,

                               

                              The name of the service name is limited by the specification to 128: https://github.com/jbosstm/narayana/blob/master/blacktie/xatmi/src/main/include/xatmi.h#L43

                               

                              Hope it helps,

                              Tom

                              • 13. Re: Hit Blacktie servers by webservice
                                joicejoy

                                The above issue is resolved. I am now able to hit Blacktie services.

                                 

                                I am getting an error when I try to hit NBFEXAMPLE server from the mdb client:

                                 

                                2015-10-09 03:57:20,913 [0x7f6addd21700] WARN  (HybridSocketEndpointQueue:397 ) - connect to localhost:12345 failed

                                The server is trying to connect to the above client IP:port. But localhost is not present in any btconfig.xml. So not sure where this is coming from.

                                 

                                Server btconfig.xml

                                 

                                <ENVIRONMENT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                        xmlns="http://www.jboss.org/blacktie">

                                        <DOMAIN>fooapp</DOMAIN>

                                 

                                 

                                        <MACHINES>

                                                <MACHINE id="nbfserv1" hostname="${HOSTNAME}"

                                                        pathToExecutable="./server"

                                                        workingDirectory="."

                                                        serverId="1"

                                                        argLine =" -p 12346"/>

                                        </MACHINES>

                                        <SERVERS>

                                                <SERVER name='nbfserv'>

                                                        <MACHINE-REF id="nbfserv1" />

                                                        <SERVICE_NAMES>

                                                                <SERVICE name='NBFEXAMPLE'/>

                                                        </SERVICE_NAMES>

                                                </SERVER>

                                        </SERVERS>

                                 

                                 

                                        <XA_RESOURCES>

                                                <XA_RESOURCE configuration="linux">

                                                        <XA_RESOURCE_MGR_ID>201</XA_RESOURCE_MGR_ID>

                                                        <XA_RESOURCE_NAME>Oracle_XA</XA_RESOURCE_NAME>

                                                        <XA_OPEN_STRING>Oracle_XA+Acc=P/roadmap3/arbor123+SesTm=60+DbgFl=15+SqlNet=RDCO1108+DB=RDCO1108+LogDir=.</XA_OPEN_STRING>

                                                        <XA_CLOSE_STRING></XA_CLOSE_STRING>

                                                        <XA_SWITCH>xaosw</XA_SWITCH>

                                                        <XA_LIB_NAME>${ORACLE_HOME}/lib/libclntsh.so</XA_LIB_NAME>

                                                </XA_RESOURCE>

                                        </XA_RESOURCES>

                                 

                                 

                                        <ORB OPT="-ORBInitRef NameService=corbaloc::${JBOSSAS_IP_ADDR}:3528/NameService -ORBListenEndpoints iiop://${JBOSSAS_IP_ADDR}:0"

                                                TRANS_FACTORY_ID="TransactionManagerService.OTS" />

                                        <TXN_CFG

                                                MGR_URL="http://${JBOSSAS_IP_ADDR}:8080/rest-at-coordinator/tx/transaction-manager"

                                                RES_EP="127.0.0.1:8888" />

                                        <SOCKETSERVER PORT="0" />

                                        <MQ HOST="${JBOSSAS_IP_ADDR}" PORT="61613" USER="guest" PASSWORD="password1@"

                                                 RECEIVE_TIMEOUT="10" TIME_TO_LIVE="40" />

                                 

                                 

                                </ENVIRONMENT>

                                • 14. Re: Hit Blacktie servers by webservice
                                  zhfeng

                                  I think you should config the HOST attribute in the mdb client btconfig.xml just like

                                   

                                  <SOCKETSERVER HOST='<your client ip address>' PORT=0>

                                   

                                  PORT 0 means a random port number and you also could specific it. If you have a fire wall on the client, I think you should specific a port number and allow it access by the incoming connections.