forked from ballerina-platform/ballerina-dev-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1177 lines (1026 loc) · 44.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
layout: ballerina-home-page
title: Ballerina Home
description: Ballerina is an open-source programming language for the cloud that makes it easier to use, combine and create network services.
keywords: ballerina, ballerinalang, cloud native, microservices, integration, programming language
---
<link href="https://fonts.googleapis.com/css?family=Special+Elite&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/css/home-page-2020.css"/>
<link rel="stylesheet" href="/css/prism.css">
<script src="/community/event-date.js"></script>
<style>
.nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover {
color: #464646;
cursor: default;
border: transparent;
border-bottom: #20b6b0 3px solid !important;
background-color: transparent !important;
}
.nav-tabs > li > a:hover {
border-color:transparent !important;
}
.disabled {
pointer-events: none;
cursor: default;
background-color: #57595d !important;
}
.nav-tabs > li > a{
border-bottom: transparent 3px solid !important;
}
.cBallerina-io-Gray-row {
padding-bottom:0px;
}
tr:last-child >td{border-bottom: 0 !important;}
a {
/* font-size: 20px; */
color: #20b6b0;
text-decoration: none;
}
.focusPane{
transition: transform .2s; /* Animation */
border: 1px #c7c7c7 solid;
}
.focusPane:hover{
transform: scale(1.019);
background-color: #f5f5f5;
border: 1px #20b6b0 solid !important;
z-index: 7;
}
.eventBanner{
background-color: #f5f5f5;
padding: 30px;
font-size: 18px;
margin-top: 15px;
font-weight: 400;
text-align: center;
}
.cVideoPlayButton {
position: absolute;
z-index: 8;
top: 59.5%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
box-sizing: content-box;
display: block;
width: 32px;
height: 44px;
background: #10101077;
border-radius: 50%;
padding: 22px 15px 10px 28px;
}
.cVideoPlayButton span {
width: 0;
height: 0;
display: block;
position: relative;
z-index: 6;
border-left: 26px solid #fff;
border-top: 16px solid transparent;
border-bottom: 16px solid transparent;
}
.cVideoPlayButton img {
position: relative;
z-index: 3;
max-width: 100%;
width: auto;
height: auto;
}
#cMainVideoFrame:hover + .cVideoPlayButton {
background: #20b6b0 !important;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: 0em;
width: 0em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 1px solid #999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.code[class*="language-"], .pre[class*="language-"] {
font-size: 12px !important;
}
.line-numbers-rows > span {
pointer-events: none;
display: none;
counter-increment: linenumber;
}
/* .cColHeight1{height:665px} */
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: none;
padding-right: 0em;
text-align: right;
}
pre.line-numbers {
position: relative;
padding-left: 15px !important;
counter-reset: linenumber;
}
pre[class*="language-"] {
padding: 0em;
margin: 0;
overflow: auto;
}
pre{
border:none !important;
}
.playground-button:hover{
color: #464646 !important;
background-image: url(/img/play-button-hover.svg) !important;
}
td.cEventDateContainer1 span.cEventDate1{
width: 100%;
font-size: 18px;
font-weight: 400;
display: inline-block;
color: #57595d;
margin-bottom: 5px;
border: none;
text-align: right;
}
tr:last-child >td{border-bottom: 0 !important;}
.cEventName{
margin-top: -2px;
font-size: 20px;
}
td.cEventDateContainer{
width: 20%;
}
.cEventDateNum{
font-size: 20px !important;
font-weight: 450 !important;
}
.cEventDate1{text-align: right;}
</style>
<link rel="stylesheet" href="/css/events-page.css">
<style>
/* table.cEventTable.docutils td.cEventDateContainer, table.cEventTable.docutils td.cEventDetail, table.cEventTable.docutils td.cEventURL {
border-bottom: 0px !important;
} */
tr:last-child >td{border-bottom: 0 !important;}
</style>
<!-- <link rel="stylesheet" href="/css/home-page-old.css"/> -->
<div class="row cBallerinaIntroSection">
<div class="container">
<div class="col-sm-12 col-md-12 cTopLayer">
<div class="col-sm-12 col-md-8">
<img class="cHomePageLogo" src="/img/ballerina-logo-whiite.svg ">
<!--<h1>A Programming Language for
Network Distributed Applications
</h1>-->
</div>
<div class="col-sm-12 col-md-4">
</div>
</div>
<div class="col-sm-12 col-md-12 cBottomLayer">
<div class="col-sm-12 col-md-7">
<p>Ballerina is an open-source programming language for the cloud that makes it easier to use, combine, and create network services.
</p>
</div>
<!-- <div class="col-sm-12 col-md-1"> </div> -->
<div class="col-sm-12 col-md-5 cMainCTAContainer">
<a class="cBallerina-io-Home-main-download-button" target="_blank" href="/learn/getting-started-with-ballerina/">
Get started
<p>Install Ballerina, set it all up <br>and take it for a spin.</p>
</a>
<a class="cBallerina-io-Home-main-download-button cPlayButton" target="_blank" href="/learn/by-example/">
Examples
<p>Explore and try Ballerina examples.<br> </p>
</a>
<!-- <a class="cBallerina-io-Home-main-download-button" href="/downloads">
Download Ballerina
<p>Distributions are available for <br>Linux, OS X, and Windows</p>
</a> -->
<!-- <ul>
<li style="margin: 0;"><a class="cIconLink" href="/learn/by-example/" target="_blank">Ballerina By Example</a></li>
<li ><a class="cIconLink" href="/learn/installing-ballerina/setting-up-ballerina/">Get Started</a></li>
</ul> -->
</div>
</div>
<!--<div class="col-sm-12 col-md-12">
<p class="cQuotes">A programming language that doesn't change the way you think about programming is not
worth knowing <span>- <a href="">Alan Perlis</a></span>
</p>
</div>-->
</div>
</div>
</div>
</div>
<!--START OF TRY BALLERINA TAB DESIGN 1-->
<div class="row cWidget cWhyBallerinaLinks" style="padding-top:3rem; padding-bottom: 8.5rem; background-color: #f5f5f5;">
<div class="container">
<div class="col-sm-12 col-md-12">
<h2 id="ballerina-in-action">Ballerina in action</h2>
<div class="cHscroll">
<ul class="nav nav-tabs cSamplesList">
<li class="active" ><a data-toggle="tab" href="#consuming-services" >Consuming services</a></li>
<li><a data-toggle="tab" href="#working-with-data" >Working with data</a></li>
<li><a data-toggle="tab" href="#restful-api" >RESTful API</a></li>
<li><a data-toggle="tab" href="#grpc-api" >gRPC API</a></li>
<li><a data-toggle="tab" href="#graphql-api" >GraphQL API</a></li>
<li><a data-toggle="tab" href="#kafka-consumer" >Kafka consumer/producer</a></li>
<li><a data-toggle="tab" href="#working-with-databases" >Working with databases</a></li>
</ul>
</div>
<div class="tab-content">
<div id="restful-api" class="tab-pane fade " >
<div class="row" style="background-color: #f5f5f5;">
<div class="col-lg-12 col-md-12 col-sm-12 focusPane " style="padding:20px;">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
import ballerina/http;
configurable int port = 8080;
type Album readonly & record {|
string id;
string title;
string artist;
decimal price;
|};
table<Album> key(id) albums = table [
{id: "1", title: "Blue Train", artist: "John Coltrane", price: 56.99},
{id: "2", title: "Jeru", artist: "Gerry Mulligan", price: 17.99},
{id: "3", title: "Sarah Vaughan and Clifford Brown", artist: "Sarah Vaughan", price: 39.99}
];
service / on new http:Listener(port) {
resource function get albums() returns Album[] {
return albums.toArray();
}
resource function get albums/[string id]() returns Album|http:NotFound {
Album? album = albums[id];
if album is () {
return http:NOT_FOUND;
} else {
return album;
}
}
resource function post albums(@http:Payload Album album) returns Album {
albums.add(album);
return album;
}
}
</code>
</pre>
</div>
</div>
</div>
<!-- <div class="col-lg-5 col-sm-12 focusPane" style="padding:20px;border: 1px #c7c7c7 solid;">
<img src="img/consuming-services-diagram.svg" style="max-width: 520px;" />
</div> -->
</div>
</div>
<div id="consuming-services" class="tab-pane fade in active" >
<div class="row cdisplayFlex" style="background-color: #f5f5f5;">
<div class="col-lg-7 col-md-12 col-sm-12 focusPane codeBlock noBottomBorder" id="column1" style="padding:20px;border: 1px #c7c7c7 solid; ">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
import ballerina/http;
import ballerinax/googleapis.sheets;
configurable string githubPAT = ?;
configurable string repository = "ballerina-platform/ballerina-lang";
configurable string sheetsAccessToken = ?;
configurable string spreadSheetId = ?;
configurable string sheetName = "Sheet1";
type PR record {
string url;
string title;
string state;
string created_at;
string updated_at;
};
public function main() returns error? {
http:Client github = check new ("https://api.github.com/repos");
map<string> headers = {
"Accept": "application/vnd.github.v3+json",
"Authorization": "token " + githubPAT
};
PR[] prs = check github->get(string `/${repository}/pulls`, headers);
sheets:Client gsheets = check new ({auth: {token: sheetsAccessToken}});
check gsheets->appendRowToSheet(spreadSheetId, sheetName,
["Issue", "Title", "State", "Created At", "Updated At"]);
foreach var {url, title, state, created_at, updated_at} in prs {
check gsheets->appendRowToSheet(spreadSheetId, sheetName,
[url, title, state, created_at, updated_at]);
}
}
</code>
</pre>
</div>
</div>
</div>
<div class="col-lg-5 col-md-12 col-sm-12 focusPane" id="column2" style="padding:20px;border: 1px #c7c7c7 solid;">
<img src="img/consuming-services-diagram.svg" style="max-width: 520px;" />
</div>
</div>
</div>
<div id="working-with-data" class="tab-pane fade" >
<div class="row cdisplayFlex" style="background-color: #f5f5f5;">
<div class="col-lg-7 col-md-12 col-sm-12 focusPane codeBlock noBottomBorder" style="padding:20px;border: 1px #c7c7c7 solid;">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
import ballerina/http;
import ballerina/io;
type Country record {
string country;
int population;
string continent;
int cases;
int deaths;
};
// Prints the top 10 countries having the highest case-fatality ratio.
public function main() returns error? {
http:Client diseaseEp = check new ("https://disease.sh/v3");
Country[] countries = check diseaseEp->get("/covid-19/countries");
json summary =
from var {country, continent, population, cases, deaths} in countries
where population >= 100000 && deaths >= 100
let decimal caseFatalityRatio = <decimal>deaths / <decimal>cases * 100
order by caseFatalityRatio descending
limit 10
select {country, continent, population, caseFatalityRatio};
io:println(summary);
}
</code>
</pre>
</div>
</div>
</div>
<div class="col-lg-5 col-md-12 col-sm-12 focusPane cColHeight1 diagramBox" style="padding:20px;border: 1px #c7c7c7 solid;">
<img src="img/working-with-data-diagram.svg" style="max-width: 520px;" />
<a target="_blank" href="https://play.ballerina.io/?gist=30a51792b6b4d46c2cbdfdd424fb3b45&file=play.bal" style="z-index: 999;">
<button class="playground-button" id="simple11" style="background:url(/img/play=button.svg)no-repeat scroll right center; color:#20b6b0;padding: 12px 30px ;border: none;float: right;background-size:20px ;font-size: 17px;margin-right: 50px;margin-top: 50px;"> Try in Playground</button>
</a>
</div>
</div>
</div>
<div id="grpc-api" class="tab-pane fade" >
<div class="row cdisplayFlex" style="background-color: #f5f5f5;">
<div class="col-lg-7 col-md-12 col-sm-12 focusPane codeBlock noBottomBorder" style="padding:20px;border: 1px #c7c7c7 solid;">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
import ballerina/grpc;
configurable int port = 9090;
Album[] albums = [
{id: "1", title: "Blue Train", artist: "John Coltrane", price: 56.99},
{id: "2", title: "Jeru", artist: "Gerry Mulligan", price: 17.99},
{id: "3", title: "Sarah Vaughan and Clifford Brown", artist: "Sarah Vaughan", price: 39.99}
];
@grpc:ServiceDescriptor {
descriptor: ROOT_DESCRIPTOR_RECORD_STORE,
descMap: getDescriptorMapRecordStore()
}
service "Albums" on new grpc:Listener(port) {
remote function getAlbum(string id) returns Album|error {
Album[] filteredAlbums = albums.filter(album => album.id == id);
if filteredAlbums.length() > 0 {
return filteredAlbums.pop();
}
return error grpc:NotFoundError(string `Cannot find the album for ID ${id}`);
}
remote function addAlbum(Album album) returns Album|error {
albums.push(album);
return album;
}
remote function listAlbums() returns stream<Album, error?>|error {
return albums.toStream();
}
}
</code>
</pre>
</div>
</div>
</div>
<div id="grpc-api-proto" class="col-lg-5 col-md-12 col-sm-12 focusPane cColHeight1 diagramBox" style="padding:20px;border: 1px #c7c7c7 solid;">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
syntax = "proto3";
import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";
service Albums {
rpc getAlbum(google.protobuf.StringValue)
returns (Album);
rpc addAlbum(Album) returns (Album);
rpc listAlbums(google.protobuf.Empty)
returns (stream Album);
}
message Album {
string id = 1;
string title = 2;
string artist = 3;
float price = 4;
};
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="graphql-api" class="tab-pane fade" >
<div class="row cdisplayFlex" style="background-color: #f5f5f5;">
<div class="col-lg-12 col-md-12 col-sm-12 focusPane" style="padding:20px;border: 1px #c7c7c7 solid;">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
import ballerina/graphql;
import ballerina/http;
import ballerinax/mysql;
import ballerinax/mysql.driver as _;
configurable string user = ?;
configurable string password = ?;
configurable string host = ?;
configurable int port = ?;
configurable string database = ?;
configurable string apiEndpoint = ?;
public type Album record {
string id;
string title;
string artist;
decimal price;
Currency currency = USD;
};
public enum Currency {
USD,
LKR,
EUR,
GBP
}
service / on new graphql:Listener(9000) {
private final mysql:Client db;
private final http:Client forex;
private final Currency baseCurrency = USD;
function init() returns error? {
self.db = check new (host, user, password, database, port);
self.forex = check new (apiEndpoint);
}
resource function get album(string id, Currency currency = USD) returns Album|error {
Album album = check self.db->queryRow(`SELECT * FROM Albums WHERE id=${id}`);
if currency != self.baseCurrency {
string query = string `from=${self.baseCurrency}&to=${currency}`;
record {decimal rate;} exchange = check self.forex->get(string `/curerncyConversion?${query}`);
album.price = album.price * exchange.rate;
album.currency = currency;
}
return album;
}
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="working-with-databases" class="tab-pane fade" >
<div class="row cdisplayFlex" style="background-color: #f5f5f5;">
<div class="col-lg-12 col-md-12 col-sm-12 focusPane" style="padding:20px;border: 1px #c7c7c7 solid;">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
import ballerina/http;
import ballerina/sql;
import ballerinax/mysql;
import ballerinax/mysql.driver as _;
configurable string host = ?;
configurable int port = ?;
configurable string user = ?;
configurable string password = ?;
configurable string database = ?;
type Album record {|
string id;
string title;
string artist;
decimal price;
|};
service / on new http:Listener(8080) {
private final mysql:Client db;
function init() returns error? {
self.db = check new (host, user, password, database, port);
}
resource function get albums() returns Album[]|error? {
stream<Album, sql:Error?> albumStream = self.db->query(`SELECT * FROM Albums`);
Album[]? albums = check from Album album in albumStream select album;
check albumStream.close();
return albums;
}
resource function get albums/[string id]() returns Album|http:NotFound|error {
Album|sql:Error result = self.db->queryRow(`SELECT * FROM Albums WHERE id = ${id}`);
if result is sql:NoRowsError {
return http:NOT_FOUND;
} else {
return result;
}
}
resource function post album(@http:Payload Album album) returns Album|error {
_ = check self.db->execute(`
INSERT INTO Albums (id, title, artist, price)
VALUES (${album.id}, ${album.title}, ${album.artist}, ${album.price});`);
return album;
}
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="kafka-consumer" class="tab-pane fade" >
<div class="row cdisplayFlex" style="background-color: #f5f5f5;">
<div class="col-lg-12 col-md-12 col-sm-12 focusPane" style="padding:20px;border: 1px #c7c7c7 solid;">
<div class="FullCode" style="background-color: #f5f5f5;">
<div class="highlight">
<pre class="language-ballerina basic ballerina">
<code class="language-ballerina ballerina" style="font-size: 12px !important;">
import ballerinax/kafka;
configurable string groupId = "order-consumers";
configurable string orders = "orders";
configurable string paymentSuccessOrders = "payment-success-orders";
configurable decimal pollingInterval = 1;
configurable string kafkaEndpoint = kafka:DEFAULT_URL;
public type Order readonly & record {|
int id;
string desc;
PaymentStatus paymentStatus;
|};
public enum PaymentStatus {
SUCCESS,
FAIL
}
final kafka:ConsumerConfiguration consumerConfigs = {
groupId: groupId,
topics: [orders],
offsetReset: kafka:OFFSET_RESET_EARLIEST,
pollingInterval
};
service on new kafka:Listener(kafkaEndpoint, consumerConfigs) {
private final kafka:Producer orderProducer;
function init() returns error? {
self.orderProducer = check new (kafkaEndpoint);
}
remote function onConsumerRecord(Order[] orders) returns error? {
check from Order 'order in orders
where 'order.paymentStatus == SUCCESS
do {
check self.orderProducer->send({
topic: paymentSuccessOrders,
value: 'order
});
};
}
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--END OF TRY BALLERINA TAB DESIGN 1-->
<div class="row cBallerinaFeatureSection cWhyBallerinaLinks" style="padding-top:3rem; padding-bottom: 6rem; ">
<div class="container">
<div class="col-sm-12 col-md-12">
<h2 id="why-ballerina">
Why Ballerina
</h2>
</div>
<div class="cHomeWhyBallerinaRow">
<div class="col-sm-12 col-md-4">
<div class="cHomeWhyBallerinaBox">
<img src="/img/home-page/icons/cloud-native.svg"/>
<h3>Cloud native</h3>
<p>Network primitives in the language make it simpler to write services and run them in the cloud.
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/why-ballerina/cloud-native/">More
info</a></li>
</ul>
</div>
</div>
<div class="col-sm-12 col-md-4">
<div class="cHomeWhyBallerinaBox">
<img src="/img/home-page/icons/flexible-typing.svg"/>
<h3>Flexibly typed</h3>
<p>Structural types with support for openness are used both for static typing within a program and for
describing service interfaces.</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/why-ballerina/flexibly-typed/">More
info</a></li>
</ul>
</div>
</div>
<div class="col-sm-12 col-md-4">
<div class="cHomeWhyBallerinaBox">
<img src="/img/home-page/icons/data-transformation.svg"/>
<h3>Data oriented</h3>
<p>Type-safe, declarative processing of JSON, XML, and tabular data with language-integrated queries.</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/why-ballerina/data-oriented/">More info</a></li>
</ul>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="cHomeWhyBallerinaRow">
<div class="col-sm-12 col-md-4">
<div class="cHomeWhyBallerinaBox">
<img src="/img/home-page/icons/graphical.svg"/>
<h3>Graphical</h3>
<p>Programs have both a textual syntax and an equivalent graphical form based on sequence diagrams.
</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/why-ballerina/graphical/">More info</a></li>
</ul>
</div>
</div>
<div class="col-sm-12 col-md-4">
<div class="cHomeWhyBallerinaBox">
<img src="/img/home-page/icons/concurrent.svg"/>
<h3>Concurrent</h3>
<p>Easy and efficient concurrency with sequence diagrams and language-managed threads without the complexity of asynchronous functions.
</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/why-ballerina/concurrent/">More info</a></li>
</ul>
</div>
</div>
<div class="col-sm-12 col-md-4">
<div class="cHomeWhyBallerinaBox">
<img src="/img/home-page/icons/reliable-maintainable.svg"/>
<h3>Reliable, maintainable</h3>
<p>Explicit error handling, static types, and concurrency safety, combined with a familiar, readable syntax make programs reliable and maintainable.</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/why-ballerina/reliable-maintainable/">More info</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row row cWidget cWhyBallerinaLinks" style="padding-top:3rem; padding-bottom: 6rem;background-color: #f5f5f5;">
<a class="cBookmarkTop" id="Developer-First"></a>
<div id="" class="container">
<div class="col-sm-12 col-md-8 cColCOntent">
<h2 id="featured-videos">Featured videos</h2>
</div>
<div class="col-sm-12 col-md-6 cVideoImage">
<h3 style="text-align: left; font-size:20px;">Why should you start programming with Ballerina?</h3><br/>
<a id="cMainVideoFrame" class="cVideoLink video-btn" data-toggle="modal" data-src="https://www.youtube.com/embed/NYrKeElltg8" data-target="#iBallerinaVideo">
<img src="/img/why-should-start-programming-with-ballerina-video-thumbnail-v2.png" alt="Ballerina Language Concepts" style="border: #a4a4a4 solid 1px;"/>
<a id="cplayvideo" class="cVideoPlayButton" data-toggle="modal" data-src="https://www.youtube.com/embed/NYrKeElltg8" data-target="#iBallerinaVideo">
<span></span>
</a>
</a>
</div>
<div class="col-sm-12 col-md-6 cVideoImage">
<h3 style="text-align: left; font-size: 20px;">Tutorial: Creating a service in Ballerina</h3><br/>
<a id="cMainVideoFrame" class="cVideoLink video-btn" data-toggle="modal" data-src="https://www.youtube.com/embed/NxyIKoHl3Dw" data-target="#iBallerinaVideo">
<img src="/img/tutorial-creating-a-service-in-ballerinathumbnail-v2.png" alt="Tutorial: Creating a Service in Ballerina" />
<a id="cplayvideo" class="cVideoPlayButton" data-toggle="modal" data-src="https://www.youtube.com/embed/NxyIKoHl3Dw" data-target="#iBallerinaVideo">
<span></span>
</a>
</a>
</div>
<div class="clearfix"></div></br>
</div>
</div>
<!--START OF TRY BALLERINA EVENT-->
<div class="row row cWidget cWhyBallerinaLinks" style="padding-top:3rem; padding-bottom: 3rem;background-color: #fff;">
<a class="cBookmarkTop" id="Developer-First"></a>
<div id="" class="container">
<div class="col-sm-12 col-md-8 cColCOntent">
<h2 id="events">Events</h2>
<h3 style="padding-right: 15px;padding-bottom: 20px;">Upcoming events</h2>
</div>
<div class="row">
<table class="cEventTable cConferencesList" style="width:100% !important;">
<tr class="bEvent1" style="display: none;">
<td class="cEventDateContainer cEventDateContainer1" >
<p class="cEventDate1 cEventDateNum dateDisplay" style="margin-bottom: 15px;">May 25, 2022</p>
<p class="cEventDate1 dateDisplay" style="margin-bottom: 15px">Wed., 6.30 p.m. PDT</p>
<p class="cEventLocation" style="text-align: right;">Online</p>
</td>
<td class="cEventDetail" id="eventDetails" >
<a target="_blank" href="https://www.meetup.com/sfjava/events/284669431">
<p class="cEventName" style="margin-top: -1px;font-size: 18px;">Meetup</p>
</a>
<h5 style="margin-bottom: 18px;">Ballerina: A Language to Develop, Consume and Combine Network Services</h5>
<a style="color: #20b6b0 ;font-weight:400;font-size: 16px;" target="_blank" href="https://twitter.com/sameerajayasoma">Sameera Jayasoma</a>, Senior Director, WSO2
</td>
<td class="cEventURL" ><a class="cEventRegistration" href="https://www.meetup.com/sfjava/events/284669431" target="_blank" style="text-align: center;">More info</a></td>
</tr>
<tr class="bEvent2" style="display: none;">
<td class="cEventDateContainer cEventDateContainer1" style="border-bottom: 0 !important;">
<p class="cEventDate1 cEventDateNum dateDisplay" style="margin-bottom: 15px;">Sep 7-14, 2022</p>
<p class="cEventDate1 dateDisplay" style="margin-bottom: 15px">Wed., 2.00 p.m. CDT</p>
<p class="cEventLocation" style="text-align: right;">Austin, TX</p>
</td>
<td class="cEventDetail" id="eventDetails" style="border-bottom: 0 !important;">
<a target="_blank" href="https://www.developerweek.com/global/conference/cloud/">
<p class="cEventName" style="margin-top: -1px;font-size: 18px;">DeveloperWeek Cloud 2022</p>
</a>
<h5 style="margin-bottom: 18px;">Ballerina: Programming Language Designed for Cloud-Native Applications</h5>
<a style="color: #20b6b0 ;font-weight:400;font-size: 16px;" target="_blank" href="https://twitter.com/sameerajayasoma">Sameera Jayasoma</a>, Senior Director, WSO2
</td>
<td class="cEventURL" style="border-bottom: 0 !important;"><a class="cEventRegistration" href="https://www.developerweek.com/global/conference/cloud/" target="_blank" style="text-align: center;">More info</a></td>
</tr>
</td>
</tr>
</table>
</div>
<!-- <div class="col-sm-12 col-md-12 cColCOntent">
<div class="col-lg-12 col-md-12 col-sm-12 eventBanner">
No upcoming events for this month.
</div>
</div> -->
<div class="clearfix"></div></br>
</div>
</div>
<!--END OF TRY BALLERINA EVENT-->
<!--<div class="row cBallerinaFeatureSection">
<div class="container">
<div class="col-sm-12 col-md-12">
<h2>
Why Ballerina
</h2>
</div>
</div>
<div class="sticky">
<div class="container">
<div class="col-sm-12 col-md-12">
<table class="cFeaturesNav">
<tr>
<td><a href="#The-Network-in-the-Language">The Network in the Language</a></td>
<td><a href="#Sequence-Diagrams-for-Programming">Sequence Diagrams for Programming</a></td>
<td><a href="#Structural-Open-by-Default-Typing">Structural, Open-by-Default Typing</a></td>
<td><a href="#From-Code-to-Cloud">From Code to Cloud</a></td>
<td><a href="#Batteries-Included">Batteries Included</a></td>
<td><a href="#Developer-First">Developer First</a></td>
</tr>
</table>
</div>
</div>
</div> -->
<!--<a class="cBookmarkTop" id="The-Network-in-the-Language"></a>-->
<!--<div class="container cFeatureSection">
<div class="col-sm-12 col-md-4 cColDiagram cSmallImage ">
<img src="/img/home-page/network-in-the-language.png"/>
</div>
<div class="col-sm-12 col-md-4 cColCOntent">-->
<!--<div id="" class="container cFeatureSection">
<div class="col-sm-12 col-md-8 cColCOntent">
<h3>The Network in the Language</h3>
<p>For decades, programming languages have treated networks simply as I/O sources. Ballerina introduces fundamental, new abstractions of client objects, services, resource functions, and listeners to bring networking into the language so that programmers can directly address the <a target="_blank" href="https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing" target="_blank">Fallacies of Distributed Computing</a> as part of their application logic. This facilitates resilient, secure, performant network applications to be within every programmer’s reach.</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/learn/user-guide/why-ballerina/the-network-in-the-language">More info</a></li>
</ul>
</div>
<div class="col-sm-12 col-md-4 cColDiagram cSmallImage">
<img src="/img/home-page/network-in-the-language.png"/>
</div>
</div>
<a class="cBookmarkTop" id="Sequence-Diagrams-for-Programming"></a>-->
<!--<div id="" class="container cFeatureSection">
<div class="col-sm-12 col-md-7 cColCOntent">
<h3>Sequence Diagrams for Programming</h3>
<p>Sequence diagrams have been everyone’s favorite tool to describe how distributed & concurrent programs work. Yet, no current programming language lets you write your logic as a sequence diagram. In Ballerina, every program is a sequence diagram that illustrates distributed and concurrent interactions automatically. The diagram is the code. The code is the diagram.</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/why-ballerina/sequence-diagrams-for-programming">More info</a></li>
</ul>
</div>
<div id="" class="col-sm-12 col-md-5 cColDiagram">
<img src="/img/home-page/sequence-diagrams-for-programming.png"/>
</div>
</div>-->
<!--<a class="cBookmarkTop" id="Structural-Open-by-Default-Typing"></a>
<div id="" class="container cFeatureSection">
<div class="col-sm-12 col-md-4 cColDiagram cSmallImage">
<img style="width:75%;" src="/img/home-page/structtypes.png"/>
</div>
<div class="col-sm-12 col-md-8 cColCOntent">
<h3>Structural, Open-by-Default Typing</h3>
<p>Static typing is the network application programmer’s development headache and dynamic typing is the reliability engineer’s nightmare. Ballerina’s statically-typed, structural type system that is designed to be network data schema friendly allows application programmers to write code that adheres to the <a target="_blank" href="https://en.wikipedia.org/wiki/Robustness_principle">Robustness Principle</a>: Be conservative in what you send, be liberal in what you accept.</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/learn/user-guide/why-ballerina/network-aware-type-system">More info</a></li>
</ul>
</div>
</div>
<a class="cBookmarkTop" id="From-Code-to-Cloud"></a>
<div id="" class="container cFeatureSection">
<div class="col-sm-12 col-md-8 cColCOntent">
<h3>From Code to Cloud</h3>
<p>In the cloud-era, running a program is no longer just a matter of compiling and executing but rather it is about compiling, building the image, pushing the image, configuring container orchestration, and .. eventually running. Ballerina brings the entire program execution process to the hands of the developer with extensible metadata that gets compiled to runnable programs for all major cloud platforms. You code, we cloud!</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/learn/user-guide/why-ballerina/from-code-to-cloud">More info</a></li>
</ul>
</div>
<div class="col-sm-12 col-md-4 cColDiagram cSmallImage">
<img src="/img/home-page/from-code-to-cloud.png"/>
</div>
</div>
<a class="cBookmarkTop" id="Batteries-Included"></a>
<div id="" class="container cFeatureSection">
<div class="col-sm-12 col-md-4 cColDiagram">
<img src="/img/home-page/batteries-included.png"/>
</div>
<div class="col-sm-12 col-md-8 cColCOntent">
<h3>Batteries Included</h3>
<p>Today’s network is democratized! HTTPS to HTTP/2 to WebSockets to WebSub to AMQP to JSON to XML to ProtoBuf to gRPC to OpenAPI to plain old bytes - Ballerina has it all in the standard library and toolchain to help developers rapidly build applications. At development time, Ballerina covers documentation, testing, sharing, versioning, and more. We plumb, you build!</p>
<ul class="cInlinelinklist">
<li><a class="cGreenLinkArrow" href="/learn/user-guide/why-ballerina/batteries-included">More info</a></li>
</ul>
</div>
</div>
<a class="cBookmarkTop" id="Developer-First"></a>
<div id="" class="container cFeatureSection">
<div class="col-sm-12 col-md-8 cColCOntent">
<h3>Developer First</h3>
<p>Programs in the real world are written once and read tens to hundreds of times. Whenever possible, Ballerina prioritizes programmer convenience & productivity with familiarity, clearer abstractions, and easier concepts over uber system performance. Today, hardware is cheap, we programmers are not and time to market is everything.</p>
</div>
<div class="col-sm-12 col-md-4 cColDiagram">
<img src="/img/home-page/developer-first.png"/>
</div>
</div>-->
</div></div>
<div class="modal fade" id="iBallerinaVideo" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="" id="video" allowscriptaccess="always" allow="autoplay" allowfullscreen="true"></iframe>></iframe>
</div>
</div>
</div>
</div>