SlideShare uma empresa Scribd logo
1 de 29
DivConq Framework’s MUMPS API
Overview of DivConq database handling and Request-Response flow
Linux, Windows                           Linux Box
           or OS X Box



            Java App            SSH
                                                   MUMPS
           w/ DivConq




Java code connects to the MUMPS database via an SSH connection. This keeps
the data secure while in transit.
Linux Box




             Java App             SSH
                                                       MUMPS
            w/ DivConq




Of course there is no reason why Java cannot run on the same box. SSH is still
used, connecting over the loopback network interface.
Linux, Windows                           Linux Box
            or OS X Box



                                Session
             Java App
                                                    MUMPS
            w/ DivConq

                               Channels



One SSH session is used. Multiple SSH channels enable greater throughput.
Typically DivConq uses three channels, which creates three MUMPS processes.
Linux, Windows                              Linux Box
            or OS X Box



             Java App
                                                       MUMPS
            w/ DivConq




Communication is Request-Response only, requests are originated in Java and
responses are supplied by MUMPS code.

By using three channels, up to three requests can be processed at once. A long
running request does not hold up other requests.
Structure

          Name:        [Stored Procedure Name]
          Kind:        “Update” or “Query”
          Params:      [any JSON-like data structure]

      Example

          Name:        “dctListPeople”
          Kind:        “Query”
          Params:      { “MinAge”: 30, “MaxAge”: 48 }

Your code builds a request and submits it to DivConq’s database interface. A
request must have a name and a kind, parameters are optional. Name = name of
the stored procedure. Kind will be Update only if it changes data within the
database (Insert, Update, Delete), otherwise use Query.
Java App                                                         MUMPS
                         DivConq
   w/ DivConq
                         Database Interface                         MUMPS
                                                                    Process
                                      Request
       Your                            Queue
                                                                    MUMPS




                                                 Database
                          Request




                                                 Workers
     Application
                          Verifier                                  Process
       Code        #1
                                     Response                       MUMPS
                                      Verifier
                                                                    Process

                          DivConq Schema


#1 - Your code builds a request and submits it. Request submission is
asynchronous, so you also must provide a callback to handle the result.
Java App                                                            MUMPS
                           DivConq
   w/ DivConq
                           Database Interface                          MUMPS
                                                                       Process
                                        Request
       Your                              Queue
                                                                       MUMPS




                                                   Database
                            Request




                                                   Workers
     Application
                            Verifier                                   Process
       Code        #1
                                       Response                        MUMPS
                                        Verifier
                                                                       Process
                      #2

                           DivConq Schema


#2 – Your request is verified, including validating the parameters with what is
declared in the schema.
Java App                                                            MUMPS
                           DivConq
   w/ DivConq
                           Database Interface                          MUMPS
                                                                       Process
                                 #3     Request
       Your                              Queue
                                                                       MUMPS




                                                   Database
                            Request




                                                   Workers
     Application
                            Verifier                                   Process
       Code        #1
                                       Response                        MUMPS
                                        Verifier
                                                                       Process
                      #2

                           DivConq Schema


#3 – If verification passes your request is put on to the request queue.
Java App                                                         MUMPS
                          DivConq
   w/ DivConq
                          Database Interface                         MUMPS
                                                                     Process
                                #3     Request    #4
       Your                             Queue
                                                                     MUMPS




                                                  Database
                           Request




                                                  Workers
     Application
                           Verifier                                  Process
       Code        #1
                                      Response               #4      MUMPS
                                       Verifier
                                                                     Process
                     #2

                          DivConq Schema


#4 – When a database worker (channel) is available, it takes the request from the
queue and sends it to MUMPS.
Java App                                                       MUMPS
                         DivConq
   w/ DivConq
                         Database Interface                        MUMPS
                                                                   Process
                               #3     Request    #4
       Your                            Queue
                                                                   MUMPS




                                                 Database
                          Request




                                                 Workers
     Application
                          Verifier                                 Process
       Code        #1
                                     Response               #4     MUMPS
                                      Verifier              and    Process
                    #2                                      #5
                         DivConq Schema


#5 – That worker then reads (blocking) the result and any accompanying
debug/error messages.
Java App                                                              MUMPS
                           DivConq
   w/ DivConq
                           Database Interface                            MUMPS
                                                                         Process
                                 #3     Request         #4
       Your                              Queue
                                                                         MUMPS




                                                        Database
                            Request




                                                        Workers
     Application
                            Verifier                                     Process
       Code        #1
                                       Response                    #4    MUMPS
                                        Verifier                   and   Process
                      #2                                           #5
                                                   #6
                           DivConq Schema


#6 – The response is verified by validating the (JSON-like) result with what is
declared in the schema. If response does not validate, error messages are
added to messages collected from MUMPS.
Java App                                                                MUMPS
                             DivConq
   w/ DivConq
                             Database Interface                            MUMPS
                                                                           Process
                                   #3     Request         #4
       Your                                Queue
                                                                           MUMPS




                                                          Database
                              Request




                                                          Workers
     Application
                              Verifier                                     Process
       Code        #1
                                         Response                    #4    MUMPS
                   #7                     Verifier                   and   Process
                        #2                                           #5
                                                     #6
                             DivConq Schema


#7 – The response and any debug/error messages are delivered to your code via
a the callback you provided at submission.
Request-Response handling within Java
Example

     RecordStruct ages = new RecordStruct();
     ages.setField("MinAge", 3);
     ages.setField("MaxAge", 8);




Parameters are composed of JSON-like structures. In DivConq use RecordStruct
to compose records (aka Objects in JSON) and ListStruct to compose lists (aka
Arrays in JSON). Records (aka Objects) have fields – just as in JSON – the field
values may be lists, records or scalars. Above we are using numeric scalars.
Example

     RecordStruct ages = new RecordStruct();
     ages.setField("MinAge", 3);
     ages.setField("MaxAge", 8);

     QueryRequest request = new QueryRequest("dctListPeople", ages);




Create the request object. The Name and Kind are required. Kind can be
derived from the class name (QueryRequest vs UpdateRequest). Name is the
first parameter to the constructor. The parameters, optionally, follow the name in
the call to the constructor.
ObjectCallback callback = new ObjectCallback() {
       @Override
       public void process(ObjectResult result) {
              System.out.println("Messages:");
              TestDb.printPretty(result.getMessages());

              System.out.println();

              System.out.println("Result:");
              TestDb.printPretty(result.getResult());
       }
     };



You also need to create a callback object. This example callback simply prints
the messages and results to the console as JSON output. You may call
“getResultAsRec” (RecordStruct) or “getResultAsList” (ListStruct) to process the
result using DivConq’s JSON-like API.
Example

     RecordStruct ages = new RecordStruct();
     ages.setField("MinAge", 3);
     ages.setField("MaxAge", 8);

     QueryRequest request = new QueryRequest("dctListPeople", ages);

     ObjectCallback callback = new ObjectCallback() ...

     Hub.instance.getDatabase().submit(request, callback);




Finally, to get the request to the database call the “submit” method and pass in
the request and callback. Your result, even if it is just an error message, will be
presented in the callback’s “process” method.
<Procedure Name="dctListPeople" Execute="listPeople^dctToyTest">
              <Description>
                        Get a list of names of all people in test data.
                        Optionally apply an age range filter
              </Description>
              <RecRequest>
                        <Field Name="MinAge" Type="Integer" />
                        <Field Name="MaxAge" Type="Integer" />
              </RecRequest>
              <ListResponse Type="String" />
     </Procedure>




A DivConq schema file holds custom data types, table declarations, stored
procedure declarations and more. Above is just one snipped from the schema file
showing the declaration for the stored procedure “dctListPeople”.
<Procedure Name="dctListPeople" Execute="listPeople^dctToyTest">
              <Description>
                        Get a list of names of all people in test data.
                        Optionally apply an age range filter
              </Description>
              <RecRequest>
                        <Field Name="MinAge" Type="Integer" />
                        <Field Name="MaxAge" Type="Integer" />
              </RecRequest>
              <ListResponse Type="String" />
     </Procedure>




Key elements here are the Request and Response which provide the validation
rules for this procedure. Expect either a RecRequest (RecordStruct) or a
ListRequest (ListStruct) for request – those are our options for request
parameters. Likewise, expect a RecResponse or a ListResponse for the
response.
Request (Params) Examples

           a: { “MinAge”: 30, “MaxAge”: 48 }
           b: { “MaxAge”: 48 }
           c: null

       Response Examples

           a: [ “Jim”, “Beth”, “Sandy” ]
           b: [ ]



Note that the params are not marked as required (in the schema), so any of the
three examples for request are valid.

The response is a list of strings. No minimum is given, so a list of zero is valid.
Linux Box
 Windows
                              Java App w/ DivConq                      MUMPS
  User w/
Web Browser                                                            MUMPS
                              Your                                     Process
                                             DivConq
                            Application
                                             Database
                              Code                                     MUMPS
                                             Interface
  External                                                             Process
  App on
                        DivConq                                        MUMPS
   Linux
                       Web Server      DivConq Schema                  Process
                       (HTTP + Web
                         Sockets)



There are many reasons to “why JSON?” – one of the best is interoperability with
web apps and other external applications. Through HTTP or WebSocket calls
JSON parameters can be sent and JSON results can be returned. To minimize
interoperability hassles DivConq favors JSON-like structures throughout.
Request-Response handling within MUMPS
Java Request (Params)

           { “MinAge”: 30, “MaxAge”: 48 }

      MUMPS Params

           Params(“MinAge”)=30
           Params(“MaxAge”)=48




JSON can be adopted to MUMPS structures without much effort, details in a
future presentation. As far as this overview is concerned, the key point is that
JSON-like structures get transformed into MUMPS structures before the stored
procedure is called.
Schema Declaration
      <Procedure Name="dctListPeople" Execute="listPeople^dctToyTest">


      MUMPS Code
      listPeople ;
       ;
       w StartList               ;   start list of people
       w ScalarStr_“Jim”         ;   write a scalar
       w ScalarStr_“Beth”        ;   write another scalar
       w EndList                 ;   end list of people
       ;
       quit


The schema tells us what MUMPS routine and function to call. Above is a hint at
what the code has to do – return a list of strings. Note how the result from the
procedure is sent back to Java by using the “write” command.
listPeople n id,minage,maxage,age
        s minage=Params("MinAge"),maxage=Params("MaxAge")
        ;
        w StartList       ; start list of people (name only)
        ;
        f s id=$o(^dctData("People",id)) q:id="" d
        . s age=^dctData("People",id,"Age")
        . i (minage'="")&(age<minage) q
        . i (maxage'="")&(age>maxage) q
        . w ScalarStr_^dctData("People",id,"Name")
        ;
        w EndList         ; end list of people
        ;
        quit



You’ll need to review the dctToyTest routine to get the details on this example, but
what you can see here is that we loop through all the people an apply the
(optional) filter. People who are not filtered are returned as scalars (just names)
in the list.
ObjectCallback callback = new ObjectCallback() {
       @Override
       public void process(ObjectResult result) {
               if (result.hasErrors()) {
                        System.out.println("Error in List");
                        return;
               }

              ListStruct names = result.getResultAsList();

              for (Struct item : names.getItems())
                       System.out.println("Name: " + item.toString());
       }
     };



Back in Java you can process the result via ListStruct by looping all the items.
We know, because of the schema validation and the call to “hasErrors”, that our
items are all just strings. There are a few ways to work with a string item, but
certainly calling “toString” will work.
There is a lot more to learn about stored procedures, but now you have an
overview of how it works as well as some of the design philosophy.

Mais conteúdo relacionado

Semelhante a dcDB Overview of Stored Procedures

The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...netvis
 
Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...
Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...
Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...Joshua Long
 
Effective cost reduction for elastic clouds under spot instance pricing throu...
Effective cost reduction for elastic clouds under spot instance pricing throu...Effective cost reduction for elastic clouds under spot instance pricing throu...
Effective cost reduction for elastic clouds under spot instance pricing throu...ieeepondy
 
Java Abs Dynamic Server Replication
Java Abs   Dynamic Server ReplicationJava Abs   Dynamic Server Replication
Java Abs Dynamic Server Replicationncct
 
Delivering SaaS Using IaaS - RightScale Compute 2013
Delivering SaaS Using IaaS - RightScale Compute 2013Delivering SaaS Using IaaS - RightScale Compute 2013
Delivering SaaS Using IaaS - RightScale Compute 2013RightScale
 
Adapative Provisioning of Stream Processing Systems in the Cloud
Adapative Provisioning of Stream Processing Systems in the CloudAdapative Provisioning of Stream Processing Systems in the Cloud
Adapative Provisioning of Stream Processing Systems in the CloudJavier Cerviño
 
Microservices Runtimes
Microservices RuntimesMicroservices Runtimes
Microservices RuntimesFrank Munz
 
How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..
How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..
How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..Matt Walters
 
IBM Managing Workload Scalability with MQ Clusters
IBM Managing Workload Scalability with MQ ClustersIBM Managing Workload Scalability with MQ Clusters
IBM Managing Workload Scalability with MQ ClustersIBM Systems UKI
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworksukdpe
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceApigee | Google Cloud
 
Data Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksData Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksMiroslav Stampar
 
Real time big data stream processing
Real time big data stream processing Real time big data stream processing
Real time big data stream processing Luay AL-Assadi
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSam Ramji
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performanceMarkTaylorIBM
 
Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...
Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...
Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...Spark Summit
 
A sdn based application aware and network provisioning
A sdn based application aware and network provisioningA sdn based application aware and network provisioning
A sdn based application aware and network provisioningStanley Wang
 
Monitoring applications on cloud - Indicthreads cloud computing conference 2011
Monitoring applications on cloud - Indicthreads cloud computing conference 2011Monitoring applications on cloud - Indicthreads cloud computing conference 2011
Monitoring applications on cloud - Indicthreads cloud computing conference 2011IndicThreads
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Semelhante a dcDB Overview of Stored Procedures (20)

The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
 
Messaging sz
Messaging szMessaging sz
Messaging sz
 
Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...
Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...
Better Living Through Messaging - Leveraging the HornetQ Message Broker at Sh...
 
Effective cost reduction for elastic clouds under spot instance pricing throu...
Effective cost reduction for elastic clouds under spot instance pricing throu...Effective cost reduction for elastic clouds under spot instance pricing throu...
Effective cost reduction for elastic clouds under spot instance pricing throu...
 
Java Abs Dynamic Server Replication
Java Abs   Dynamic Server ReplicationJava Abs   Dynamic Server Replication
Java Abs Dynamic Server Replication
 
Delivering SaaS Using IaaS - RightScale Compute 2013
Delivering SaaS Using IaaS - RightScale Compute 2013Delivering SaaS Using IaaS - RightScale Compute 2013
Delivering SaaS Using IaaS - RightScale Compute 2013
 
Adapative Provisioning of Stream Processing Systems in the Cloud
Adapative Provisioning of Stream Processing Systems in the CloudAdapative Provisioning of Stream Processing Systems in the Cloud
Adapative Provisioning of Stream Processing Systems in the Cloud
 
Microservices Runtimes
Microservices RuntimesMicroservices Runtimes
Microservices Runtimes
 
How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..
How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..
How to CQRS in node: Eventually Consistent, Distributed Microservice Systems..
 
IBM Managing Workload Scalability with MQ Clusters
IBM Managing Workload Scalability with MQ ClustersIBM Managing Workload Scalability with MQ Clusters
IBM Managing Workload Scalability with MQ Clusters
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile Performance
 
Data Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection AttacksData Retrieval over DNS in SQL Injection Attacks
Data Retrieval over DNS in SQL Injection Attacks
 
Real time big data stream processing
Real time big data stream processing Real time big data stream processing
Real time big data stream processing
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile Performance
 
IBM MQ - better application performance
IBM MQ - better application performanceIBM MQ - better application performance
IBM MQ - better application performance
 
Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...
Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...
Interactive Visualization of Streaming Data Powered by Spark by Ruhollah Farc...
 
A sdn based application aware and network provisioning
A sdn based application aware and network provisioningA sdn based application aware and network provisioning
A sdn based application aware and network provisioning
 
Monitoring applications on cloud - Indicthreads cloud computing conference 2011
Monitoring applications on cloud - Indicthreads cloud computing conference 2011Monitoring applications on cloud - Indicthreads cloud computing conference 2011
Monitoring applications on cloud - Indicthreads cloud computing conference 2011
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Último

Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingScyllaDB
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 

Último (20)

Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 

dcDB Overview of Stored Procedures

  • 2. Overview of DivConq database handling and Request-Response flow
  • 3. Linux, Windows Linux Box or OS X Box Java App SSH MUMPS w/ DivConq Java code connects to the MUMPS database via an SSH connection. This keeps the data secure while in transit.
  • 4. Linux Box Java App SSH MUMPS w/ DivConq Of course there is no reason why Java cannot run on the same box. SSH is still used, connecting over the loopback network interface.
  • 5. Linux, Windows Linux Box or OS X Box Session Java App MUMPS w/ DivConq Channels One SSH session is used. Multiple SSH channels enable greater throughput. Typically DivConq uses three channels, which creates three MUMPS processes.
  • 6. Linux, Windows Linux Box or OS X Box Java App MUMPS w/ DivConq Communication is Request-Response only, requests are originated in Java and responses are supplied by MUMPS code. By using three channels, up to three requests can be processed at once. A long running request does not hold up other requests.
  • 7. Structure Name: [Stored Procedure Name] Kind: “Update” or “Query” Params: [any JSON-like data structure] Example Name: “dctListPeople” Kind: “Query” Params: { “MinAge”: 30, “MaxAge”: 48 } Your code builds a request and submits it to DivConq’s database interface. A request must have a name and a kind, parameters are optional. Name = name of the stored procedure. Kind will be Update only if it changes data within the database (Insert, Update, Delete), otherwise use Query.
  • 8. Java App MUMPS DivConq w/ DivConq Database Interface MUMPS Process Request Your Queue MUMPS Database Request Workers Application Verifier Process Code #1 Response MUMPS Verifier Process DivConq Schema #1 - Your code builds a request and submits it. Request submission is asynchronous, so you also must provide a callback to handle the result.
  • 9. Java App MUMPS DivConq w/ DivConq Database Interface MUMPS Process Request Your Queue MUMPS Database Request Workers Application Verifier Process Code #1 Response MUMPS Verifier Process #2 DivConq Schema #2 – Your request is verified, including validating the parameters with what is declared in the schema.
  • 10. Java App MUMPS DivConq w/ DivConq Database Interface MUMPS Process #3 Request Your Queue MUMPS Database Request Workers Application Verifier Process Code #1 Response MUMPS Verifier Process #2 DivConq Schema #3 – If verification passes your request is put on to the request queue.
  • 11. Java App MUMPS DivConq w/ DivConq Database Interface MUMPS Process #3 Request #4 Your Queue MUMPS Database Request Workers Application Verifier Process Code #1 Response #4 MUMPS Verifier Process #2 DivConq Schema #4 – When a database worker (channel) is available, it takes the request from the queue and sends it to MUMPS.
  • 12. Java App MUMPS DivConq w/ DivConq Database Interface MUMPS Process #3 Request #4 Your Queue MUMPS Database Request Workers Application Verifier Process Code #1 Response #4 MUMPS Verifier and Process #2 #5 DivConq Schema #5 – That worker then reads (blocking) the result and any accompanying debug/error messages.
  • 13. Java App MUMPS DivConq w/ DivConq Database Interface MUMPS Process #3 Request #4 Your Queue MUMPS Database Request Workers Application Verifier Process Code #1 Response #4 MUMPS Verifier and Process #2 #5 #6 DivConq Schema #6 – The response is verified by validating the (JSON-like) result with what is declared in the schema. If response does not validate, error messages are added to messages collected from MUMPS.
  • 14. Java App MUMPS DivConq w/ DivConq Database Interface MUMPS Process #3 Request #4 Your Queue MUMPS Database Request Workers Application Verifier Process Code #1 Response #4 MUMPS #7 Verifier and Process #2 #5 #6 DivConq Schema #7 – The response and any debug/error messages are delivered to your code via a the callback you provided at submission.
  • 16. Example RecordStruct ages = new RecordStruct(); ages.setField("MinAge", 3); ages.setField("MaxAge", 8); Parameters are composed of JSON-like structures. In DivConq use RecordStruct to compose records (aka Objects in JSON) and ListStruct to compose lists (aka Arrays in JSON). Records (aka Objects) have fields – just as in JSON – the field values may be lists, records or scalars. Above we are using numeric scalars.
  • 17. Example RecordStruct ages = new RecordStruct(); ages.setField("MinAge", 3); ages.setField("MaxAge", 8); QueryRequest request = new QueryRequest("dctListPeople", ages); Create the request object. The Name and Kind are required. Kind can be derived from the class name (QueryRequest vs UpdateRequest). Name is the first parameter to the constructor. The parameters, optionally, follow the name in the call to the constructor.
  • 18. ObjectCallback callback = new ObjectCallback() { @Override public void process(ObjectResult result) { System.out.println("Messages:"); TestDb.printPretty(result.getMessages()); System.out.println(); System.out.println("Result:"); TestDb.printPretty(result.getResult()); } }; You also need to create a callback object. This example callback simply prints the messages and results to the console as JSON output. You may call “getResultAsRec” (RecordStruct) or “getResultAsList” (ListStruct) to process the result using DivConq’s JSON-like API.
  • 19. Example RecordStruct ages = new RecordStruct(); ages.setField("MinAge", 3); ages.setField("MaxAge", 8); QueryRequest request = new QueryRequest("dctListPeople", ages); ObjectCallback callback = new ObjectCallback() ... Hub.instance.getDatabase().submit(request, callback); Finally, to get the request to the database call the “submit” method and pass in the request and callback. Your result, even if it is just an error message, will be presented in the callback’s “process” method.
  • 20. <Procedure Name="dctListPeople" Execute="listPeople^dctToyTest"> <Description> Get a list of names of all people in test data. Optionally apply an age range filter </Description> <RecRequest> <Field Name="MinAge" Type="Integer" /> <Field Name="MaxAge" Type="Integer" /> </RecRequest> <ListResponse Type="String" /> </Procedure> A DivConq schema file holds custom data types, table declarations, stored procedure declarations and more. Above is just one snipped from the schema file showing the declaration for the stored procedure “dctListPeople”.
  • 21. <Procedure Name="dctListPeople" Execute="listPeople^dctToyTest"> <Description> Get a list of names of all people in test data. Optionally apply an age range filter </Description> <RecRequest> <Field Name="MinAge" Type="Integer" /> <Field Name="MaxAge" Type="Integer" /> </RecRequest> <ListResponse Type="String" /> </Procedure> Key elements here are the Request and Response which provide the validation rules for this procedure. Expect either a RecRequest (RecordStruct) or a ListRequest (ListStruct) for request – those are our options for request parameters. Likewise, expect a RecResponse or a ListResponse for the response.
  • 22. Request (Params) Examples a: { “MinAge”: 30, “MaxAge”: 48 } b: { “MaxAge”: 48 } c: null Response Examples a: [ “Jim”, “Beth”, “Sandy” ] b: [ ] Note that the params are not marked as required (in the schema), so any of the three examples for request are valid. The response is a list of strings. No minimum is given, so a list of zero is valid.
  • 23. Linux Box Windows Java App w/ DivConq MUMPS User w/ Web Browser MUMPS Your Process DivConq Application Database Code MUMPS Interface External Process App on DivConq MUMPS Linux Web Server DivConq Schema Process (HTTP + Web Sockets) There are many reasons to “why JSON?” – one of the best is interoperability with web apps and other external applications. Through HTTP or WebSocket calls JSON parameters can be sent and JSON results can be returned. To minimize interoperability hassles DivConq favors JSON-like structures throughout.
  • 25. Java Request (Params) { “MinAge”: 30, “MaxAge”: 48 } MUMPS Params Params(“MinAge”)=30 Params(“MaxAge”)=48 JSON can be adopted to MUMPS structures without much effort, details in a future presentation. As far as this overview is concerned, the key point is that JSON-like structures get transformed into MUMPS structures before the stored procedure is called.
  • 26. Schema Declaration <Procedure Name="dctListPeople" Execute="listPeople^dctToyTest"> MUMPS Code listPeople ; ; w StartList ; start list of people w ScalarStr_“Jim” ; write a scalar w ScalarStr_“Beth” ; write another scalar w EndList ; end list of people ; quit The schema tells us what MUMPS routine and function to call. Above is a hint at what the code has to do – return a list of strings. Note how the result from the procedure is sent back to Java by using the “write” command.
  • 27. listPeople n id,minage,maxage,age s minage=Params("MinAge"),maxage=Params("MaxAge") ; w StartList ; start list of people (name only) ; f s id=$o(^dctData("People",id)) q:id="" d . s age=^dctData("People",id,"Age") . i (minage'="")&(age<minage) q . i (maxage'="")&(age>maxage) q . w ScalarStr_^dctData("People",id,"Name") ; w EndList ; end list of people ; quit You’ll need to review the dctToyTest routine to get the details on this example, but what you can see here is that we loop through all the people an apply the (optional) filter. People who are not filtered are returned as scalars (just names) in the list.
  • 28. ObjectCallback callback = new ObjectCallback() { @Override public void process(ObjectResult result) { if (result.hasErrors()) { System.out.println("Error in List"); return; } ListStruct names = result.getResultAsList(); for (Struct item : names.getItems()) System.out.println("Name: " + item.toString()); } }; Back in Java you can process the result via ListStruct by looping all the items. We know, because of the schema validation and the call to “hasErrors”, that our items are all just strings. There are a few ways to work with a string item, but certainly calling “toString” will work.
  • 29. There is a lot more to learn about stored procedures, but now you have an overview of how it works as well as some of the design philosophy.