{"id":13702278,"url":"https://github.com/amitshekhariitbhu/NYBus","last_synced_at":"2025-05-05T04:30:56.437Z","repository":{"id":94553522,"uuid":"100239043","full_name":"amitshekhariitbhu/NYBus","owner":"amitshekhariitbhu","description":"NYBus (RxBus) - A pub-sub library for Android and Java applications","archived":false,"fork":false,"pushed_at":"2024-08-18T19:21:02.000Z","size":398,"stargazers_count":288,"open_issues_count":4,"forks_count":51,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-10-30T02:52:43.802Z","etag":null,"topics":["android","eventbus","eventbus-library","java-application","pub","pub-sub","publisher","pubsub","rxbus","rxbus2","rxjava","rxjava-android","rxjava2","subscriber"],"latest_commit_sha":null,"homepage":"https://outcomeschool.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/amitshekhariitbhu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2017-08-14T07:12:19.000Z","updated_at":"2024-09-22T15:46:48.000Z","dependencies_parsed_at":"2024-08-18T20:06:22.313Z","dependency_job_id":null,"html_url":"https://github.com/amitshekhariitbhu/NYBus","commit_stats":{"total_commits":99,"total_committers":6,"mean_commits":16.5,"dds":0.3737373737373737,"last_synced_commit":"6faf24e184f014333d7625b262f3bc55118bde33"},"previous_names":["mindorksopensource/nybus"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitshekhariitbhu%2FNYBus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitshekhariitbhu%2FNYBus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitshekhariitbhu%2FNYBus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitshekhariitbhu%2FNYBus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amitshekhariitbhu","download_url":"https://codeload.github.com/amitshekhariitbhu/NYBus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252439469,"owners_count":21748009,"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":["android","eventbus","eventbus-library","java-application","pub","pub-sub","publisher","pubsub","rxbus","rxbus2","rxjava","rxjava-android","rxjava2","subscriber"],"created_at":"2024-08-02T21:00:33.148Z","updated_at":"2025-05-05T04:30:55.560Z","avatar_url":"https://github.com/amitshekhariitbhu.png","language":"Java","funding_links":[],"categories":["Uncategorized","进程间通信"],"sub_categories":["Uncategorized","Spring Cloud框架"],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg alt=\"NYBus\" src=https://raw.githubusercontent.com/amitshekhariitbhu/NYBus/master/assets/nybus.png /\u003e\n\u003c/p\u003e\n\n# NYBus(RxBus) - A pub-sub library for Android and Java applications.\n\n## [Outcome School Blog](https://outcomeschool.com/blog) - High-quality content to learn Android concepts.\n\n### This pub-sub library NYBus(RxBus) uses RxJava(RxJava2) for creating RxBus(RxBus2). You must have used EventBus. NYBus is very similar to the EventBus. NYBus is implemented using RxJava(RxJava2).\n\n### Overview of NYBus(RxBus) pub-sub library\n* NYBus is used for posting any type of event to subscribe class in Android and Java applications.\n* NYBus also support channel to avoid the problem of event getting received at undesirable places.\n* NYBus also support thread customization(thread in which the event should be posted).\n* NYBus is built on RxJava(RxJava2).\n\n## Using NYBus(RxBus) Library in your application\n\nAdd this in your `settings.gradle`:\n```groovy\nmaven { url 'https://jitpack.io' }\n```\n\nIf you are using `settings.gradle.kts`, add the following:\n```kotlin\nmaven { setUrl(\"https://jitpack.io\") }\n```\n\n## Android\nAdd this in your `build.gradle`\n```groovy\nimplementation 'com.github.amitshekhariitbhu.NYBus:nybus-android:1.0.0'\n```\n\nIf you are using `build.gradle.kts`, add the following:\n```kotlin\nimplementation(\"com.github.amitshekhariitbhu.NYBus:nybus-android:1.0.0\")\n```\n\n## Java\nAdd this in your `build.gradle`\n```groovy\nimplementation 'com.github.amitshekhariitbhu.NYBus:nybus-java:1.0.0'\n```\n\nIf you are using `build.gradle.kts`, add the following:\n```kotlin\nimplementation(\"com.github.amitshekhariitbhu.NYBus:nybus-java:1.0.0\")\n```\n\n## To run all the test cases\n```groovy\ngradlew connectedAndroidTest test\n```\n\n## Simple Usage\n\n### Register on default channel\n```java\nNYBus.get().register(this);\n```\n\n### Unregister from default channel\n```java\nNYBus.get().unregister(this);\n```\n\n### Post on default channel\n```java\nNYBus.get().post(event);\n```\n\n### Receive on default channel\n```java\n@Subscribe\npublic void onEvent(Event event) {\n\n}\n```\n\n## Usage with specific channel\n\n### Register on specific channel\n```java\nNYBus.get().register(this, Channel.ONE);\n```\n\n### Register on more than one channel\n```java\nNYBus.get().register(this, Channel.ONE, Channel.TWO);\n```\n\n### Unregister from channel\n```java\nNYBus.get().unregister(this, Channel.ONE);\n```\n\n### Unregister from more than one channel\n```java\nNYBus.get().unregister(this, Channel.ONE, Channel.TWO);\n```\n\n### Post on a specific channel\n```java\nNYBus.get().post(event, Channel.ONE);\n```\n\n### Receive on a specific channel\n```java\n@Subscribe(channelId = Channel.ONE)\npublic void onEvent(Event event) {\n\n}\n```\n\n### Receive on more than one channel\n```java\n@Subscribe(channelId = {Channel.ONE, Channel.TWO})\npublic void onEvent(Event event) {\n\n}\n```\n## Usage with specific thread\n\n### Receive on specific thread\n```java\n@Subscribe(threadType = NYThread.MAIN)\npublic void onEvent(Event event) {\n\n}\n```\n\n### Receive on a specific channel and a specific thread\n```java\n@Subscribe(channelId = Channel.ONE, threadType = NYThread.IO)\npublic void onEvent(Event event) {\n\n}\n```\n\n### Enable Logging\n```java\nNYBus.get().enableLogging();\n```\nIt will log: D/NYBus: No target found for the eventclass com.mindorks.Event\n\n## If this library helps you in anyway, show your love :heart: by putting a :star: on this project :v:\n\nYou can connect with me on:\n\n- [Twitter](https://twitter.com/amitiitbhu)\n- [LinkedIn](https://www.linkedin.com/in/amit-shekhar-iitbhu)\n- [GitHub](https://github.com/amitshekhariitbhu)\n- [Facebook](https://www.facebook.com/amit.shekhar.iitbhu)\n\n[**Read all of our blogs here.**](https://outcomeschool.com/blog)\n\n### License\n```\n   Copyright (C) 2024 Amit Shekhar\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n\n### Contributing to NYBus\nAll pull requests are welcome, make sure to follow the [contribution guidelines](CONTRIBUTING.md)\nwhen you submit pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famitshekhariitbhu%2FNYBus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famitshekhariitbhu%2FNYBus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famitshekhariitbhu%2FNYBus/lists"}