SlideShare una empresa de Scribd logo
1 de 27
UNDER THE HOOD
Mike Schonberg
Agenda

   Transports
   Queues
   Publishers
   Events
   Value Added Components
   Code
   Introduction to Bridges
Transports

   Establish connections connections between
    publishers and subscribers
     Mechanism varies widely between middlewares
      • NSD (NYSE Technologies Data Fabric)
      • Broker based (Avis, AMQP, TIBCO Rendezvous)
      • Multicast topic resolution (Informatica LBM)
   Global configuration and tuning
     Buffer sizes
     Network parameters
     Throttle rates
Queues

   Queue based threading model
     One dispatch thread per queue
     Several dispatch modes
      • Single event: invoke one callback and return
      • Timed: dispatch until empty or timeout
      • Continuous: dispatch forever
   Callback based
   Advanced features
     Watermarks to monitor queue depth
     Enqueue callback to integrate with other event loops
   Custom callbacks
Publishers

   Send messages and requests
   One publisher per topic
   Associated with a specific transport
   Thinnest possible wrapper to native publishing
   Support throttled publishing
   Advanced publishing framework
     dqpublisher in source
     Stateful (market data publishing)
Subscriptions

   Subscription to a single topic
     Receive message from all publishers of topic
   onMsg() callback invoked for each message
   Creation throttled
   Optional wildcard support
   Basic vs. stateful (market data)
     Stateful receive initial state
     Stateful monitor sequence numbers
Inbox

   Receives replies through onMsg() callback
     Multiple replies possible
      • From different subscribers
      • From the same subscriber
   Parameter to publisher_sendFromInbox()
   Supports multiple requests
Timers

   Repeating timers
   Interval is floating point in seconds
     Resolution dependent on native middleware or OS
   onTimerCallback()
     Enqueued on most once per interval
     Queue depth makes non-deterministic
   OpenMAMA provides default implementation
IO Events

   Asynchronous IO support
     For non-blocking file descriptors and sockets
   Invokes callbacks for read and write readiness
   Support is optional
   Integrates asynchronous IO into OpenMAMA event
    dispatching
OpenMAMA: Value-added Components
Other Components

   Stateful market data subscriptions/data
    quality
   Advanced publishing framework
   Data dictionary
   Fault tolerance
Stateful Subscription




   Initial value
    delivered point-to-
    point
   Complex sequence
    number logic
   Other potential
    applications
Data Quality

   Essential for Stateful/Market Data Subscriptions
   Sequence number monitoring
     Request recap on gap detection
     Recap is an initial image
   Pre-initial spooling
   Service disruptions from native middleware
   Callbacks inform application of data quality events
     STALE -> data definitely lost
     POSSIBLY_STALE -> data may be lost
Advanced Publishing

   Framework for publishing to stateful/market data
    subscribers
   Sequence number and status fields for data quality
   Initial value requests
   Recap requests
   Refresh messages
     Opitional
Data Dictionary

   OpenMAMA supports self describing messages
     Field type, name, id (integer) and value
   Sending names with every msg -> big messages
   Dictionary maps id’s to names, types and values
     From a server as a message
     Loaded from a file
     Built dynamically
   Allows integration of non-self describing payloads
Fault Tolerance

   Applications can run in fault tolerant groups
   Every instance has a unique weight
   Heart beat messages determine failure
     UDP multicast
     Bridge using OpenMAMA and native middleware
   Callbacks inform instances of transitions
   Application responsible for recovery logic
OpenMAMA in Action
Let’s write a program!

   Create a publisher
     Open a session
     Pack a payload
     Send message
   Create a subscriber
     Open interest in a topic
     Receive message callback
     Unpack message
OpenMAMA Publisher Example

   Taken from                   int main(void) {
    mamapublisherc.c example        initializeMama ();
                                    createIntervalTimer ();
   Publishes a message at          createInboundSubscription ();
    regular interval                createPublisher ();
   Subscribes to a request         mama_start(gMamaBridge);
    topic                           return 0;
                                 }
   Sends reply on receiving a
    request
   Key concepts
       Publishing
       Subscribing
       Replying to requests
       Creating messages
       Timers
Initialization

                                     void initializeMama(void) {
   Load middleware                    mama_status status;

    bridge                               status = mama_loadBridge(&gMamaBridge,
                                                              gMiddleware);

     By name “wmw”,                     if (status != MAMA_STATUS_OK) {
                                             printf ("Error loading bridge: %sn",
      “lbm”, “tibrv” or “avis”                         mamaStatus_stringForStatus (status));
                                             exit (status);
                                         }
   Initialize OpenMAMA                    status = mama_open();

   Create or get queue                  mama_getDefaultEventQueue(gMamaBridge,
                                                 &gMamaDefaultQueue);

   Create a transport                   status = mamaTransport_allocate(&gTransport);
                                         status = mamaTransport_create(gTransport,
      • Two step                     }
                                                              gTransportName, gMamaBridge);

          1.   Allocate
          2.   Create (initialize)
Create a Timer

                           static void createIntervalTimer(void){
   Initialize timer         status = mamaTimer_create(&gTimer,
                                                    gMamaDefaultQueue,
     Default queue from                            timerCb,
                                                    1.0,
      initialization                    NULL);
                           }
     1 second interval
                           static void MAMACALLTYPE
     Repeating            timerCb(mamaTimer timer, void* closure){
                              publishMessage (NULL);
                           }
   Callback publishes
    message
Create a Subscription

                            static void createInboundSubscription (void){
   Subscription for            gInboundCb.onCreate   = createCb;

    requests                    gInboundCb.onError
                                gInboundCb.onMsg
                                                     = errorCb;
                                                      = msgCb;
                                gInboundCb.onQuality  = NULL;
     Send reply for each       gInboundCb.onGap      = NULL;
                                gInboundCb.onRecapRequest = NULL;

      request                   mamaSubscription_allocate(&gSubscription);

                                mamaSubscription_createBasic(gSubscription,
   Callbacks                    gTransport, gMamaDefaultQueue, gInboundCb,
                                    “REQUEST_TOPIC”, NULL);

     No messages before    }

                            static void MAMACALLTYPE
      createCb              inboundMsgCb(mamaSubscription subscription,
                               mamaMsg msg, void* closure, void* itemClosure){

   Two step create             if (!mamaMsg_isFromInbox (msg)) {
                                    return;
                                }
   msgCb for each          }
                                publishMessage (msg);


    message
Publishing

   Publisher requires transport and    static void createPublisher(void){
                                           mamaPublisher_create(&gPub, gTransport,
    topic.                                  “MAMA_TOPIC”, NULL, NULL);
       Optional source and root        }

                                        static void publishMessage(mamaMsg request){
                                           static int msgNumber = 0;
   Sending Messages                       static mamaMsg msg = NULL;
       Static message reused
                                              if (msg == NULL) {
                                                       mamaMsg_create(&msg);
                                              }
                                              else {
       Standard MAMA fields: Status                   mamaMsg_clear(msg);
        and SeqNo                             }

                                            mamaMsg_addI32(msg, MamaFieldMsgStatus.mName,
                                             MamaFieldMsgStatus.mFid, MAMA_MSG_STATUS_OK);

       Custom field: Publisher Topic       mamaMsg_addI32(msg, MamaFieldSeqNum.mName,
                                             MamaFieldSeqNum.mFid, msgNumber++);

                                            mamaMsg_addString (msg, "PubTopic", 10002, “MAMA_TOPIC”);

       request != NULL: called from        if (request){
        msgCb(). Point-to-point reply           mamaPublisher_sendReplyToInbox(gPublisher, request, msg);
                                            }
                                            else {
       Request == NULL: called from        }
                                                mamaPublisher_send(gPublisher, msg);
        timerCb(). Multicast message.   }
What Does it Do?




   Timer callback fired every second
       Sends a message on “MAMA_TOPIC”
   Listens for messages on “REQUEST_TOPIC”
       Message callback fired
        •   If inbound message is a request then send reply
Middleware Bridges - Overview
Bridges

   Payload and Message Bridges
     Directly reflect top-level API
      • Messages, subscriptions, queues, timers, etc.
     One-to-one function mapping
   Virtual function table
     Dynamic loading and static linking
     Multiple bridges simultaneously
     OpenMAMA macros build/load table
      • Bridge implementations just provide methods
mschonberg@nyx.com

Más contenido relacionado

Último

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Último (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

OpenMAMA Under the Hood

  • 2. Agenda  Transports  Queues  Publishers  Events  Value Added Components  Code  Introduction to Bridges
  • 3. Transports  Establish connections connections between publishers and subscribers  Mechanism varies widely between middlewares • NSD (NYSE Technologies Data Fabric) • Broker based (Avis, AMQP, TIBCO Rendezvous) • Multicast topic resolution (Informatica LBM)  Global configuration and tuning  Buffer sizes  Network parameters  Throttle rates
  • 4. Queues  Queue based threading model  One dispatch thread per queue  Several dispatch modes • Single event: invoke one callback and return • Timed: dispatch until empty or timeout • Continuous: dispatch forever  Callback based  Advanced features  Watermarks to monitor queue depth  Enqueue callback to integrate with other event loops  Custom callbacks
  • 5. Publishers  Send messages and requests  One publisher per topic  Associated with a specific transport  Thinnest possible wrapper to native publishing  Support throttled publishing  Advanced publishing framework  dqpublisher in source  Stateful (market data publishing)
  • 6. Subscriptions  Subscription to a single topic  Receive message from all publishers of topic  onMsg() callback invoked for each message  Creation throttled  Optional wildcard support  Basic vs. stateful (market data)  Stateful receive initial state  Stateful monitor sequence numbers
  • 7. Inbox  Receives replies through onMsg() callback  Multiple replies possible • From different subscribers • From the same subscriber  Parameter to publisher_sendFromInbox()  Supports multiple requests
  • 8. Timers  Repeating timers  Interval is floating point in seconds  Resolution dependent on native middleware or OS  onTimerCallback()  Enqueued on most once per interval  Queue depth makes non-deterministic  OpenMAMA provides default implementation
  • 9. IO Events  Asynchronous IO support  For non-blocking file descriptors and sockets  Invokes callbacks for read and write readiness  Support is optional  Integrates asynchronous IO into OpenMAMA event dispatching
  • 11. Other Components  Stateful market data subscriptions/data quality  Advanced publishing framework  Data dictionary  Fault tolerance
  • 12. Stateful Subscription  Initial value delivered point-to- point  Complex sequence number logic  Other potential applications
  • 13. Data Quality  Essential for Stateful/Market Data Subscriptions  Sequence number monitoring  Request recap on gap detection  Recap is an initial image  Pre-initial spooling  Service disruptions from native middleware  Callbacks inform application of data quality events  STALE -> data definitely lost  POSSIBLY_STALE -> data may be lost
  • 14. Advanced Publishing  Framework for publishing to stateful/market data subscribers  Sequence number and status fields for data quality  Initial value requests  Recap requests  Refresh messages  Opitional
  • 15. Data Dictionary  OpenMAMA supports self describing messages  Field type, name, id (integer) and value  Sending names with every msg -> big messages  Dictionary maps id’s to names, types and values  From a server as a message  Loaded from a file  Built dynamically  Allows integration of non-self describing payloads
  • 16. Fault Tolerance  Applications can run in fault tolerant groups  Every instance has a unique weight  Heart beat messages determine failure  UDP multicast  Bridge using OpenMAMA and native middleware  Callbacks inform instances of transitions  Application responsible for recovery logic
  • 18. Let’s write a program!  Create a publisher  Open a session  Pack a payload  Send message  Create a subscriber  Open interest in a topic  Receive message callback  Unpack message
  • 19. OpenMAMA Publisher Example  Taken from int main(void) { mamapublisherc.c example initializeMama (); createIntervalTimer ();  Publishes a message at createInboundSubscription (); regular interval createPublisher ();  Subscribes to a request mama_start(gMamaBridge); topic return 0; }  Sends reply on receiving a request  Key concepts  Publishing  Subscribing  Replying to requests  Creating messages  Timers
  • 20. Initialization void initializeMama(void) {  Load middleware mama_status status; bridge status = mama_loadBridge(&gMamaBridge, gMiddleware);  By name “wmw”, if (status != MAMA_STATUS_OK) { printf ("Error loading bridge: %sn", “lbm”, “tibrv” or “avis” mamaStatus_stringForStatus (status)); exit (status); }  Initialize OpenMAMA status = mama_open();  Create or get queue mama_getDefaultEventQueue(gMamaBridge, &gMamaDefaultQueue);  Create a transport status = mamaTransport_allocate(&gTransport); status = mamaTransport_create(gTransport, • Two step } gTransportName, gMamaBridge); 1. Allocate 2. Create (initialize)
  • 21. Create a Timer static void createIntervalTimer(void){  Initialize timer status = mamaTimer_create(&gTimer, gMamaDefaultQueue,  Default queue from timerCb, 1.0, initialization NULL); }  1 second interval static void MAMACALLTYPE  Repeating timerCb(mamaTimer timer, void* closure){ publishMessage (NULL); }  Callback publishes message
  • 22. Create a Subscription static void createInboundSubscription (void){  Subscription for gInboundCb.onCreate = createCb; requests gInboundCb.onError gInboundCb.onMsg = errorCb; = msgCb; gInboundCb.onQuality = NULL;  Send reply for each gInboundCb.onGap = NULL; gInboundCb.onRecapRequest = NULL; request mamaSubscription_allocate(&gSubscription); mamaSubscription_createBasic(gSubscription,  Callbacks gTransport, gMamaDefaultQueue, gInboundCb, “REQUEST_TOPIC”, NULL);  No messages before } static void MAMACALLTYPE createCb inboundMsgCb(mamaSubscription subscription, mamaMsg msg, void* closure, void* itemClosure){  Two step create if (!mamaMsg_isFromInbox (msg)) { return; }  msgCb for each } publishMessage (msg); message
  • 23. Publishing  Publisher requires transport and static void createPublisher(void){ mamaPublisher_create(&gPub, gTransport, topic. “MAMA_TOPIC”, NULL, NULL);  Optional source and root } static void publishMessage(mamaMsg request){ static int msgNumber = 0;  Sending Messages static mamaMsg msg = NULL;  Static message reused if (msg == NULL) { mamaMsg_create(&msg); } else {  Standard MAMA fields: Status mamaMsg_clear(msg); and SeqNo } mamaMsg_addI32(msg, MamaFieldMsgStatus.mName, MamaFieldMsgStatus.mFid, MAMA_MSG_STATUS_OK);  Custom field: Publisher Topic mamaMsg_addI32(msg, MamaFieldSeqNum.mName, MamaFieldSeqNum.mFid, msgNumber++); mamaMsg_addString (msg, "PubTopic", 10002, “MAMA_TOPIC”);  request != NULL: called from if (request){ msgCb(). Point-to-point reply mamaPublisher_sendReplyToInbox(gPublisher, request, msg); } else {  Request == NULL: called from } mamaPublisher_send(gPublisher, msg); timerCb(). Multicast message. }
  • 24. What Does it Do?  Timer callback fired every second  Sends a message on “MAMA_TOPIC”  Listens for messages on “REQUEST_TOPIC”  Message callback fired • If inbound message is a request then send reply
  • 26. Bridges  Payload and Message Bridges  Directly reflect top-level API • Messages, subscriptions, queues, timers, etc.  One-to-one function mapping  Virtual function table  Dynamic loading and static linking  Multiple bridges simultaneously  OpenMAMA macros build/load table • Bridge implementations just provide methods

Notas del editor

  1. Establishes connections between publisher and subscribersTopic resolution informationBrokers can be in or out of processMulticast address and channelIP Address and portFor daemon/brokerFor topic resolution daemon
  2. Native middleware enqueues events Application threads dequeue eventsDequeuing invokes a callback Queues must be thread safeMultiple dispatch threads possible but not desirableMessage arrive out of order Callback based. Event driven as opposed to reading from a streamCallback methods receive object (subscription, io, etc.), event specific data (message) and application supplied closure High and low watermarks allow applications to react to detect slow consumersQueues grow dynamicallyCurrent implementations support unrestricted growthPotentially problematicCustom callbacks allow applications to delegate arbitrary work to dispatch threads.
  3. Request is a message that supports point-to-point repliesPossibly over TCP The throttle paces non-critical publishing to avoid congestion Advanced publishing allows publishers to emulate a FHHandle initial value requestsAdd fields required for data quality (status and sequence number)
  4. callback paramters: subscription, message, and closure Subscription creation and other actions that may generate network load are throttledRate is configurable Wildcard support varies among native middlewarsData Fabric supports regex based wildcard subscriptions Stateful subscriptions useful for market data and possibly other applicationsInitial value contains initial state. Subsequent messages represent incremental changes to the stateSequence number gaps require recaps to reestablish stateRecap requests throttledMust handle fail over
  5. Default implementation in common uses an internal thread and select to enqueue timer events.
  6. Typical implementation might create an IO thread that monitors file descriptors with epoll or select and enqueues events for descriptors returned by the poll function.
  7. Sequence number logic must account for asynchronous message arrival.Messages arriving before initial with later sequence numberEspecially with different interfaces/transports for point-to-pointGaps after the initial Although intended for this use case: any application that require stored initial state with updates as deltasStreaming database query: receive 100 rows as initial. Updates for changed and new rows.
  8. Pre-intial spooling avoids recaps if there is a gap after the initial arrivesCommon for middlewares with different mechanisms for multicast and request/reply Transport level callbacks and topic/subscription level callbacks.
  9. ActivestandyUsually FT group contains 2 instances but can be more Assigned weights designate primaries and standby instances. Highest is active.Application receives callbacks indicating initial status and transitionsActive->standbyStandby->active
  10. Sample code abridged. #includes, variable declarations, error checking, logging etc. removed. mama_start() is the only OpenMAMA API call in main()starts dispatch thread and blocksUntil mama_stop() called from another threadMama_startBackground() starts and returns creating its own dispatch thread
  11. Many objects in OpenMAMA use two step initialization. Allows throttling In some cases re-use
  12. Timers do not use two step initializationpublishMessage creates and publishes messages. Covered in detail later.
  13. Other callbacks for market data subscriptionsTwo step creation. Various set methods that change subscription behavior called between allocate and create Create may generate network activity so throttled.Basic subscription is stateless, non-market-data. No DQ or initial. Last parameter to create is a closure Supplied by application. Passed back in callback. Callback only publishes reply if message is a request (isFromInbox)
  14. Source and root for some market data applications. More meaningful for middlewares with hierarchical name spaces.
  15. Not enough time to cover in detail