{"id":26233989,"url":"https://github.com/teragrep/rlp_01","last_synced_at":"2025-06-14T22:07:02.710Z","repository":{"id":44535239,"uuid":"341165610","full_name":"teragrep/rlp_01","owner":"teragrep","description":"Teragrep Reliable Event Logging Protocol (RELP) Library for Java","archived":false,"fork":false,"pushed_at":"2025-04-07T09:40:30.000Z","size":168,"stargazers_count":4,"open_issues_count":16,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T10:23:20.684Z","etag":null,"topics":["java","log","log-management","logging","relp","relp-client","rfc-5424","rfc5424","syslog","syslog-client","teragrep"],"latest_commit_sha":null,"homepage":"https://teragrep.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teragrep.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-22T10:42:44.000Z","updated_at":"2025-04-07T09:40:34.000Z","dependencies_parsed_at":"2024-05-28T11:16:06.870Z","dependency_job_id":"02797144-7dbf-4e46-8d0b-a3beca6bc4d6","html_url":"https://github.com/teragrep/rlp_01","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_01","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_01/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_01/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_01/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teragrep","download_url":"https://codeload.github.com/teragrep/rlp_01/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237834,"owners_count":21397401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","log","log-management","logging","relp","relp-client","rfc-5424","rfc5424","syslog","syslog-client","teragrep"],"created_at":"2025-03-13T01:18:23.142Z","updated_at":"2025-04-22T12:11:46.290Z","avatar_url":"https://github.com/teragrep.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Java RELP Library (rlp_01)\n\nrlp_01 implements RELP protocol in Java using NIO interface and enables users\nto send syslog formatted messages to a RELP server such as\nlink:https://github.com/rsyslog/rsyslog[rsyslog].\n\n== License\nApache License Version 2.0\n\n\n== Features\nCurrent\n\n- RELP Client\n- RELP TLS\n- RELP Server (See https://github.com/teragrep/rlp_03)\n\n== Example\n[source,xml]\n----\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cproject xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\u003e\n    \u003cdependencies\u003e\n        \u003c!-- this library --\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.teragrep\u003c/groupId\u003e\n            \u003cartifactId\u003erlp_01\u003c/artifactId\u003e\n            \u003cversion\u003e\u003c/version\u003e \u003c!-- see github --\u003e\n        \u003c/dependency\u003e\n        \u003c!-- for syslog rfc5424 formatting --\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.cloudbees\u003c/groupId\u003e\n            \u003cartifactId\u003esyslog-java-client\u003c/artifactId\u003e\n            \u003cversion\u003e1.1.7\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/project\u003e\n----\n\n[source,java]\n----\nimport com.teragrep.rlp_01.RelpBatch;\nimport com.teragrep.rlp_01.RelpConnection;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.security.AlgorithmConstraints;\nimport java.security.GeneralSecurityException;\nimport java.util.Date;\nimport java.util.concurrent.TimeoutException;\nimport java.util.function.Supplier;\n\nimport com.cloudbees.syslog.Facility;\nimport com.cloudbees.syslog.Severity;\nimport com.cloudbees.syslog.SyslogMessage;\n\nimport javax.net.ssl.SSLContext;\nimport javax.net.ssl.SSLEngine;\nimport javax.net.ssl.SSLParameters;\n\nclass Main {\n\n    public static void main(String[] args) {\n\n        final String serverHostname = \"127.0.0.1\";\n        final int serverPort = 601;\n\n        boolean useTls = false;\n\n        RelpConnection relpConnection;\n        if (useTls) {\n            try {\n                SSLContext sslContext = SSLContextFactory.authenticatedContext(\n                        \"keystore.jks\",\n                        \"changeit\",\n                        \"TLSv1.3\"\n                );\n\n                Supplier\u003cSSLEngine\u003e sslEngineSupplier = sslContext::createSSLEngine;\n                /*\n                // in case there is a need to configure these:\n                SSLEngine sslEngine = sslContext.createSSLEngine();\n                SSLParameters sslParameters = new SSLParameters();\n                sslParameters.setAlgorithmConstraints();\n                sslParameters.setCipherSuites();\n                sslEngine.setSSLParameters(sslParameters);\n                 */\n\n                relpConnection = new RelpConnection(sslEngineSupplier);\n            } catch (GeneralSecurityException | IOException exception) {\n                exception.printStackTrace();\n            }\n        } else {\n            relpConnection = new RelpConnection();\n        }\n\n        Main.openConnection(relpConnection, serverHostname, serverPort); // connection helper method\n\n        RelpBatch relpBatch = new RelpBatch(); // create new relpBatch\n\n        // Craft syslog message\n        SyslogMessage syslog = new SyslogMessage()\n                .withTimestamp(new Date().getTime())\n                .withSeverity(Severity.WARNING)\n                .withAppName(\"appName\")\n                .withHostname(\"hostName\")\n                .withFacility(Facility.USER)\n                .withMsg(\"Hello RELP World!\");\n\n\n        relpBatch.insert(syslog.toRfc5424SyslogMessage().getBytes(StandardCharsets.UTF_8)); // insert one message\n\n        boolean notSent = true;\n        while (notSent) { // retry until sent\n\n            try {\n                relpConnection.commit(relpBatch); // send batch\n            } catch (IOException | TimeoutException e) {\n                e.printStackTrace();\n            }\n\n            if (!relpBatch.verifyTransactionAll()) { // failed batch\n                relpBatch.retryAllFailed(); // re-queue failed events\n                relpConnection.tearDown(); // teardown connection\n                Main.openConnection(relpConnection, serverHostname, serverPort); // reconnect\n            } else { // successful batch\n                notSent = false;\n            }\n        }\n    }\n\n    private static void openConnection(RelpConnection relpConnection,\n                                       String serverHostname,\n                                       int serverPort) {\n        // connect helper method\n        boolean connected = false;\n        while (!connected) {\n            try {\n                connected = relpConnection.connect(serverHostname, serverPort);  // connect\n            } catch (IOException | TimeoutException e) { // error happened during the connect\n                e.printStackTrace();\n                relpConnection.tearDown(); // retry with clean connection\n            }\n\n            if (!connected) {\n                // reconnect after an interval\n                try {\n                    Thread.sleep(500); // reconnect interval\n                } catch (InterruptedException e) {\n                    e.printStackTrace();\n                }\n            }\n        }\n    }\n}\n----\n\n\n== Debugging\nConfigure slf4j provider to enable debug messages. RelpParser logs only on trace level.\n\n== Contributing\n\n// Change the repository name in the issues link to match with your project's name\n\nYou can involve yourself with our project by https://github.com/teragrep/rlp_01/issues/new/choose[opening an issue] or submitting a pull request. \n\nContribution requirements:\n\n. *All changes must be accompanied by a new or changed test.* If you think testing is not required in your pull request, include a sufficient explanation as why you think so.\n. Security checks must pass\n. Pull requests must align with the principles and http://www.extremeprogramming.org/values.html[values] of extreme programming.\n. Pull requests must follow the principles of Object Thinking and Elegant Objects (EO).\n\nRead more in our https://github.com/teragrep/teragrep/blob/main/contributing.adoc[Contributing Guideline].\n\n=== Contributor License Agreement\n\nContributors must sign https://github.com/teragrep/teragrep/blob/main/cla.adoc[Teragrep Contributor License Agreement] before a pull request is accepted to organization's repositories. \n\nYou need to submit the CLA only once. After submitting the CLA you can contribute to all Teragrep's repositories. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteragrep%2Frlp_01","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteragrep%2Frlp_01","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteragrep%2Frlp_01/lists"}