This file contains 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/lang.runtime; | |
import ballerina/log; | |
public function main() returns error? { | |
_ = check executeWithRetry(myTest, 3, 5, "this is an error"); | |
} | |
# Executes a given function with retry. If there is no error the function will | |
# immediately return. If there's errors it will retry as per given parameters. |
This file contains 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 ballerinax/mysql.driver as _; //as we do not use it in the code | |
import ballerinax/mysql; | |
import ballerina/sql; | |
import ballerina/io; | |
final mysql:Client mysqlClient = check new (user = "root", | |
password = "root", database = "hospital_data"); | |
service /hospitalservice on new http:Listener(9090) { |
This file contains 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
<!-- ================================================= --> | |
<!-- Message Builders --> | |
<!-- ================================================= --> | |
<messageBuilder contentType="application/file" | |
class="org.apache.axis2.format.BinaryBuilder"/> | |
<!-- ================================================= --> | |
<!-- Message Formatters --> | |
<!-- ================================================= --> | |
<messageFormatter contentType="application/file" |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<endpoint name="TestHTTPEP" xmlns="http://ws.apache.org/ns/synapse"> | |
<http method="post" uri-template="http://localhost:9000/sendfile"> | |
<suspendOnFailure> | |
<initialDuration>-1</initialDuration> | |
<progressionFactor>1.0</progressionFactor> | |
</suspendOnFailure> | |
<markForSuspension> | |
<retriesBeforeSuspension>0</retriesBeforeSuspension> | |
</markForSuspension> |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<sequence name="FileStreamingSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse"> | |
<log description="log" level="custom"> | |
<property name="message" value="File streaming invoked"/> | |
</log> | |
<fileconnector.read> | |
<source>/Users/hasitha/temp/file-streaming/sourceFile</source> | |
<contentType>application/file</contentType> | |
<filePattern>.*\.mkv</filePattern> | |
<streaming>true</streaming> |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<api context="/streamfile" name="StreamFileInvokeAPI" xmlns="http://ws.apache.org/ns/synapse"> | |
<resource methods="POST"> | |
<inSequence> | |
<sequence key="FileStreamingSeq"/> | |
<respond description="respond back"/> | |
</inSequence> | |
<outSequence/> | |
<faultSequence/> | |
</resource> |
This file contains 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
InputStream requestStream = httpExchange.getRequestBody(); | |
File targetFile = new File("/Users/hasitha/temp/file-streaming/targetFile/targetFile.mkv"); | |
OutputStream outStream = null; | |
try { | |
outStream = new FileOutputStream(targetFile); | |
byte[] buffer = new byte[8 * 1024]; | |
int bytesRead; | |
while ((bytesRead = requestStream.read(buffer)) != -1) { | |
outStream.write(buffer, 0, bytesRead); |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<api context="/healthz" name="ProbeAPI" xmlns="http://ws.apache.org/ns/synapse"> | |
<resource methods="POST GET"> | |
<inSequence> | |
<respond/> | |
</inSequence> | |
<outSequence/> | |
<faultSequence/> | |
</resource> | |
</api> |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<api context="/testapi" name="testAPI" xmlns="http://ws.apache.org/ns/synapse"> | |
<resource methods="POST GET"> | |
<inSequence> | |
<log> | |
<property name="message" value="API HIT!!"/> | |
</log> | |
<property expression="wso2:vault-lookup('mypassword1')" name="testProperty" scope="default" type="STRING"/> | |
<log level="custom"> | |
<property expression="$ctx:testProperty" name="secure valut log"/> |
This file contains 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
FROM docker.wso2.com/wso2mi:latest | |
COPY CarbonProbeCompositeApplication_1.0.0.car /home/wso2carbon/wso2mi-1.1.0/repository/deployment/server/carbonapps | |
COPY testProjectCompositeApplication_1.0.0.car /home/wso2carbon/wso2mi-1.1.0/repository/deployment/server/carbonapps | |
COPY --chown=wso2carbon:wso2 secure-vault.properties /home/wso2carbon/wso2mi-1.1.0/registry/config/repository/components/secure-vault/ | |
COPY --chown=wso2carbon:wso2 secret-conf.properties /home/wso2carbon/wso2mi-1.1.0/conf/security | |
COPY --chown=wso2carbon:wso2 cipher-tool.properties /home/wso2carbon/wso2mi-1.1.0/conf/security | |
COPY --chown=wso2carbon:wso2 password-tmp /home/wso2carbon/wso2mi-1.1.0 |
NewerOlder