This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/http; | |
import ballerina/io; | |
import ballerina/log; | |
@http:ServiceConfig { | |
basePath: "/" | |
} | |
service httpService on new http:Listener(9090) { | |
@http:ResourceConfig { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/artemis; | |
import ballerina/log; | |
import ballerina/io; | |
public function main() { | |
artemis:Producer prod = new({host:"localhost", port:61616}, "my_address", addressConfig = {routingType:artemis:MULTICAST}); | |
map<string> msg = {"Hello":"World", "some":"world"}; | |
byte[6] vals = [1,2,2,3,3,2]; | |
io:ReadableByteChannel ch = io:openReadableFile("/home/riyafa/abc.pdf"); | |
var err = prod->send(vals); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/artemis; | |
import ballerina/io; | |
@artemis:ServiceConfig{ | |
queueConfig:{ | |
queueName:"my_queue", | |
addressName:"my_address", | |
routingType: artemis:MULTICAST | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/artemis; | |
import ballerina/log; | |
import ballerina/io; | |
public function main() { | |
artemis:Producer prod = new({host:"localhost", port:61616}, "my_queue"); | |
map<string> msg = {"Hello":"World", "some":"world"}; | |
byte[] vals = [1,2,2,3,3,2]; | |
var err = prod->send(vals); | |
err = prod->send(msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/artemis; | |
import ballerina/io; | |
@artemis:ServiceConfig{ | |
queueConfig:{ | |
queueName:"my_queue" | |
} | |
} | |
service artemisConsumer on new artemis:Listener({host:"localhost", port:61616}){ | |
resource function onMessage(artemis:Message message) returns error? { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package riyafa.jms; | |
import java.util.Properties; | |
import javax.naming.Context; | |
import javax.naming.InitialContext; | |
import javax.jms.Queue; | |
import javax.jms.Session; | |
import javax.jms.Message; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/io; | |
import ballerina/http; | |
string ping = "ping"; | |
byte[] pingData = ping.toBytes(); | |
public function main() { | |
http:WebSocketClient wsClientEp = new("wss://echo.websocket.org", config={secureSocket: { | |
trustedCertFile:"/home/riyafa/websocketorg.crt" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/io; | |
import ballerina/http; | |
public function main() { | |
http:WebSocketClient wsClientEp = new("ws://echo.websocket.org", config = {callbackService: ClientService}); | |
checkpanic wsClientEp->pushText("hello"); | |
} | |
service ClientService =@http:WebSocketServiceConfig {} service { | |
//This resource is triggered when a new text frame is received from the remote backend. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/io; | |
import ballerina/http; | |
import ballerina/runtime; | |
@final string REMOTE_BACKEND_URL = "ws://localhost:15500/websocket"; | |
boolean isComplete = false; | |
function main(string[] args) { | |
http:WebSocketClient wsClientEp; | |
http:WebSocketClientEndpointConfig wsConfig = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/log; | |
import ballerina/http; | |
@final string NAME = "NAME"; | |
@final string AGE = "AGE"; | |
endpoint http:WebSocketListener ep { | |
port:9090 | |
}; | |
@http:ServiceConfig { |