Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language

7 views

Published on

In this slide deck, Paul explores how the Ballerina programming language's type-system, security model, syntax, and core concepts take into account network endpoints, payloads and the semantics of network distributed applications.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language

  1. 1. Re-inventing middleware in a programming language September 2019 Dr. Paul Fremantle, CTO and Co-Founder, WSO2 @pzfreo #ballerinalang
  2. 2. (Almost) Every programmer is using and/or creating APIs
  3. 3. Existing languages treat the network as simply I/O Ballerina treats APIs, listeners, endpoints, network types as first class entities
  4. 4. Ballerina is a modern, compiled, type safe, concurrent programming language Open Source implementations, Apache Licensed Open Specification, Creative Commons Licensed
  5. 5. Hello World
  6. 6. caller hello GET Hello World
  7. 7. Annotations
  8. 8. caller hello POST (name) Hello, name!
  9. 9. caller hello POST (status) response twitter tweet (status) response
  10. 10. ○ Built in taint analysis ○ Built in API Gateway (JWT and OAuth) ○ Research on embedding SPIFFE into the language ○ First-class integration with Istio / Envoy More info here: https://github.com/prabath/ballerina-security
  11. 11. Based on sequence diagrams
  12. 12. ○ A type defined by union of two or more other types float | string v1 = "John"; float | string v2 = 457.68; float | string 0.51 1.01 457.68 -11.0 “John” “name” “” “bal” // The return type of 'post' is a union of 'http:Response' and 'error' http:Response | error response = orderEP -> post("/create", reqPayload)
  13. 13. json is just a union - () | int | float | string | map<json> | json[] // JSON object json payload = { "orderdata": { "id": 1, "name": "XYZ", "price": 2500 } }; //Access object values json orderid = payload.orderdata.id; //JSON arrays json orders = { "orderdata": [ { "id": 1, "name": "XYZ", "price": 2500 }, { "id": 2, "name": "ABC", "price": 3000 } ] };
  14. 14. // Simple XML literal xml x1 = xml`<name>Paul Fremantle</name>`; // XML with namespaces xmlns "http://wso2.com" as ns0; xml x2 = xml `<name id="123" status="married"> <ns0:fname>Paul</ns0:fname> <ns0:lname>Fremantle</ns0:lname> </name>`; // XML literal with interpolation string lastName = "Fremantle"; xml x3 = xml`<lname>${lastName}</lname>`; // Concat XML values xml x4 = x1 + x2 + x3;
  15. 15. Cloud native
  16. 16. Concurrency
  17. 17. future<int> f = start add( 2,2); if (f.isDone()) { int result = wait f; io:println(result); } else if (f.isCancelled()) { io:println("cancelled"); } else { io:print("cancelling: "); io:println(f.cancel()); }
  18. 18. Batteries included
  19. 19. ○ Test ○ Documentation ○ Swagger tooling ○ gRPC tooling ○ Secret encryption ○ Docker / Kubernetes integration ○ Istio integration
  20. 20. Serverless
  21. 21. Observability
  22. 22. Continuous Integration
  23. 23. OpenAPI / Swagger
  24. 24. $ ballerina openapi gen-contract hello -i demo.bal Note: This is an Experimental tool shipped under ballerina hence this will only support limited set of functionality. Successfully generated the ballerina contract at location /Users/paul/10demo/hello.openapi.yaml
  25. 25. gRPC and ProtoBuf
  26. 26. Ballerina syntax Automatically creates this .proto
  27. 27. My setup ● Ballerina 1.0.0 ○ Tested this morning :-) ● Docker ○ 2.1.1.0 edge ○ Kubernetes: v1.14.3 ● Visual Studio Code 1.38 ● Ballerina vscode plugin
  28. 28. https://ballerina.io/learn/by-example/
  29. 29. https://github.com/ballerina-platform/ballerina-spec
  30. 30. ○ Join the Ballerina Hackathon ○ Write your first Ballerina program ○ Help us bridge Ballerina with your Apache project ○ Come to https://ballerina.io ○ Join the slack channel and/or ballerina-dev mailing list ○ Create a package ○ A connector to your Apache project! ○ Create issues ○ On the spec or implementation ○ If you have compiler skills, submit PRs on nBallerina or jBallerina
  31. 31. Homepage https://ballerina.io/ Downloads https://ballerina.io/downloads/ Ballerina By Example https://ballerina.io/learn/by-example/ Github https://github.com/ballerina-platform/ballerina-lang

×