{"id":26234033,"url":"https://github.com/teragrep/rlp_03","last_synced_at":"2025-06-10T15:31:08.395Z","repository":{"id":57728881,"uuid":"449336132","full_name":"teragrep/rlp_03","owner":"teragrep","description":"Teragrep RELP library for Java","archived":false,"fork":false,"pushed_at":"2025-04-08T07:48:39.000Z","size":626,"stargazers_count":1,"open_issues_count":18,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-22T12:12:09.975Z","etag":null,"topics":["java","java-library","log","log-collector","log-management","logging","relp","relp-client","relp-library","relp-server","syslog","syslog-server","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":"agpl-3.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,"zenodo":null}},"created_at":"2022-01-18T15:18:42.000Z","updated_at":"2025-04-08T07:48:43.000Z","dependencies_parsed_at":"2024-02-26T11:30:17.266Z","dependency_job_id":"3396002b-4d95-483b-a941-ab2800820ac2","html_url":"https://github.com/teragrep/rlp_03","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_03","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_03/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_03/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_03/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teragrep","download_url":"https://codeload.github.com/teragrep/rlp_03/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teragrep%2Frlp_03/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":257304573,"owners_count":22524434,"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","java-library","log","log-collector","log-management","logging","relp","relp-client","relp-library","relp-server","syslog","syslog-server","teragrep"],"created_at":"2025-03-13T01:18:32.190Z","updated_at":"2025-06-10T15:31:08.355Z","avatar_url":"https://github.com/teragrep.png","language":"Java","readme":"= Java RELP Server Library (rlp_03)\n\nrlp_03 implements RELP server in Java\n\n== License\nAGPLv3 with link:https://github.com/teragrep/rlp_03/blob/master/LICENSE#L665-L670[additional permissions] granted in the license.\n\n== Features\nCurrent\n\n- Fast (~100 000 transactions in a second per thread)\n- Secure (TLS)\n\n== Usage\n=== Setting dependencies\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_03\u003c/artifactId\u003e\n            \u003cversion\u003e${see_latest_at_github}\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/project\u003e\n----\n\nNOTE: See https://github.com/teragrep/rlp_01[rlp_01] for relp relpClient\n\nNOTE: See https://github.com/teragrep/rlo_06[rlo_06] for syslog decoding\n\n=== Examples\n\nDependencies for examples\n\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_03\u003c/artifactId\u003e\n            \u003cversion\u003e${see_latest_at_github}\u003c/version\u003e\n        \u003c/dependency\u003e\n        \u003c!-- rlp_01 for relp-relpClient --\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.teragrep\u003c/groupId\u003e\n            \u003cartifactId\u003erlp_01\u003c/artifactId\u003e\n            \u003cversion\u003e${see_latest_at_github}\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/project\u003e\n----\n\nServer with shared handler for all connections. See ExampleRelpClient.java for relpClient.\n\n[source,java]\n----\npackage com.teragrep.rlp_03.readme;\n\nimport com.teragrep.net_01.eventloop.EventLoop;\nimport com.teragrep.net_01.eventloop.EventLoopFactory;\nimport com.teragrep.rlp_03.frame.delegate.DefaultFrameDelegate;\nimport com.teragrep.rlp_03.frame.delegate.FrameContext;\nimport com.teragrep.rlp_03.frame.delegate.FrameDelegate;\nimport com.teragrep.net_01.server.ServerFactory;\nimport com.teragrep.net_01.channel.socket.PlainFactory;\nimport org.junit.jupiter.api.Test;\n\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\n/**\n * For use cases in the README.adoc\n */\npublic class ReadmeTest {\n\n    @Test\n    public void testServerSetup() {\n        int listenPort = 10601;\n        int threads = 1; // processing threads shared across the connections\n        ExecutorService executorService = Executors.newFixedThreadPool(threads);\n\n        /*\n         * System.out.println is used to print the frame payload\n         */\n        Consumer\u003cFrameContext\u003e syslogConsumer = new Consumer\u003cFrameContext\u003e() {\n\n            // NOTE: synchronized because frameDelegateSupplier returns this instance for all the parallel connections\n            @Override\n            public synchronized void accept(FrameContext frameContext) {\n                System.out.println(frameContext.relpFrame().payload().toString());\n            }\n        };\n\n        /*\n         * New instance of the frameDelegate is provided for every connection\n         */\n        Supplier\u003cFrameDelegate\u003e frameDelegateSupplier = new Supplier\u003cFrameDelegate\u003e() {\n\n            @Override\n            public FrameDelegate get() {\n                System.out.println(\"Providing frameDelegate for a connection\");\n                return new DefaultFrameDelegate(syslogConsumer);\n            }\n        };\n\n        /*\n         * EventLoop is used to notice any events from the connections\n         */\n        EventLoopFactory eventLoopFactory = new EventLoopFactory();\n        EventLoop eventLoop;\n        try {\n            eventLoop = eventLoopFactory.create();\n        }\n        catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n\n        Thread eventLoopThread = new Thread(eventLoop);\n        /*\n         * eventLoopThread must run, otherwise nothing will be processed\n         */\n        eventLoopThread.start();\n\n        /*\n         * ServerFactory is used to create server instances\n         */\n        ServerFactory serverFactory = new ServerFactory(\n                eventLoop,\n                executorService,\n                new PlainFactory(),\n                new FrameDelegationClockFactory(frameDelegateSupplier)\n        );\n\n        try {\n            serverFactory.create(listenPort);\n            System.out.println(\"server started at port \u003c\" + listenPort + \"\u003e\");\n        }\n        catch (IOException ioException) {\n            throw new UncheckedIOException(ioException);\n        }\n\n        /*\n         * Send Hello, World! via rlp_01\n         */\n        new ExampleRelpClient(listenPort).send(\"Hello, World!\");\n        new ExampleRelpClient(listenPort).send(\"Hello, World again!\");\n\n        /*\n         * Stop eventLoop\n         */\n        eventLoop.stop();\n\n        /*\n         * Wait for stop to complete\n         */\n        try {\n            eventLoopThread.join();\n        }\n        catch (InterruptedException interruptedException) {\n            throw new RuntimeException(interruptedException);\n        }\n        System.out.println(\"server stopped at port \u003c\" + listenPort + \"\u003e\");\n\n        executorService.shutdown();\n    }\n}\n----\n\nIf a separate handler is required for each connection which doesn’t need to be a thread-safe, create a new FrameDelegate in the Supplier\u003cFrameDelegate\u003e\n\n[source, java]\n----\n        Supplier\u003cFrameDelegate\u003e frameDelegateSupplier = () -\u003e {\n            System.out.println(\"Providing frameDelegate for a connection\");\n            return new DefaultFrameDelegate(frameContext -\u003e System.out.println(frameContext.relpFrame().payload().toString()));\n        };\n----\n\nIf a deferred handler is required for command processing, pass custom RelpEvent implementation to DefaultFrameDelegate via the Map\u003cString, RelpEvent\u003e constructor. See ReadmeDeferredTest.java for an example.\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_03/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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteragrep%2Frlp_03","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteragrep%2Frlp_03","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteragrep%2Frlp_03/lists"}