{"id":18753020,"url":"https://github.com/spotify/dns-java","last_synced_at":"2025-07-13T09:32:37.612Z","repository":{"id":14907004,"uuid":"17630966","full_name":"spotify/dns-java","owner":"spotify","description":"DNS wrapper library that provides SRV lookup functionality","archived":false,"fork":false,"pushed_at":"2023-07-03T08:46:30.000Z","size":245,"stargazers_count":203,"open_issues_count":8,"forks_count":45,"subscribers_count":108,"default_branch":"master","last_synced_at":"2024-04-14T20:17:05.830Z","etag":null,"topics":["dns","dnsjava","srv"],"latest_commit_sha":null,"homepage":null,"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/spotify.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2014-03-11T13:16:54.000Z","updated_at":"2024-04-05T05:53:49.000Z","dependencies_parsed_at":"2022-09-26T21:51:11.064Z","dependency_job_id":null,"html_url":"https://github.com/spotify/dns-java","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fdns-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fdns-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fdns-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotify%2Fdns-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spotify","download_url":"https://codeload.github.com/spotify/dns-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223556109,"owners_count":17164698,"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":["dns","dnsjava","srv"],"created_at":"2024-11-07T17:23:50.783Z","updated_at":"2024-11-07T17:23:51.331Z","avatar_url":"https://github.com/spotify.png","language":"Java","readme":"# DEPRECATION NOTICE\n\nThis repo is no longer actively maintained. While it should continue to work and there are no major known bugs, we will not be improving dns-java or releasing new versions.\n\n[![Circle CI](https://circleci.com/gh/spotify/dns-java.svg?style=svg)](https://circleci.com/gh/spotify/dns-java)\n[![Coverage Status](https://coveralls.io/repos/spotify/dns-java/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/spotify/dns-java?branch=master)\n[![Maven Central](https://img.shields.io/maven-central/v/com.spotify/dns.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.spotify%22%20dns*)\n[![License](https://img.shields.io/github/license/spotify/dns-java.svg)](LICENSE)\n\nspotify-dns-java\n================\n\nThis small DNS wrapper library provides some useful pieces of functionality related to SRV lookups.\n\n## Resilience\n\nSometimes it is useful to default to previously returned, retained values, if a dns lookup should \nfail or return an empty result. This behavior is controlled by the ```retainingDataOnFailures()``` \nand  ```retentionDurationMillis(long)``` methods in\n[DnsSrvResolvers.DnsSrvResolverBuilder](src/main/java/com/spotify/dns/DnsSrvResolvers.java).\n\n## Watching for Changes\n\nIt's often useful to update where you try to connect based on changes in lookup results, and this library\nprovides functionality that allows you to get notified when things change by implementing this interface (defined in the [ChangeNotifier](src/main/java/com/spotify/dns/ChangeNotifier.java) interface):\n\n```java\n  interface Listener\u003cT\u003e {\n\n    /**\n     * Signal that set of records changed.\n     *\n     * @param changeNotification An object containing details about the change\n     */\n    void onChange(ChangeNotification\u003cT\u003e changeNotification);\n  }\n\n  /**\n   * A change event containing the current and previous set of records.\n   */\n  interface ChangeNotification\u003cT\u003e {\n    Set\u003cT\u003e current();\n    Set\u003cT\u003e previous();\n  }\n```\n\nTake a look  at the [PollingUsage example](src/test/java/com/spotify/dns/examples/PollingUsage.java) for an example.\n\n## Metrics\n\nIf you have a statistics system that can be integrated with using the munin protocol, the method\nmetered() in DnsSrvResolvers.DnsSrvResolverBuilder enables this in conjunction with the spotify\nmunin forwarder. Have a look at the\n[BasicUsage example](src/test/java/com/spotify/dns/examples/BasicUsage.java) for details on how to\nset that up.\n\n## Usage\n\nThe entry point to lookups is through an instance of\n[DnsSrvResolver](src/main/java/com/spotify/dns/DnsSrvResolver.java) obtained via the\n[DnsSrvResolvers](src/main/java/com/spotify/dns/DnsSrvResolvers.java) factory class.\n\nTo periodically check a set of records and react to changes, use the\n[DnsSrvWatcher](src/main/java/com/spotify/dns/DnsSrvWatcher.java) interface obtained via the\n[DnsSrvWatchers](src/main/java/com/spotify/dns/DnsSrvWatchers.java) factory class.\n\nFor example code, have a look at\n[BasicUsage example](src/test/java/com/spotify/dns/examples/BasicUsage.java) and\n[PollingUsage example](src/test/java/com/spotify/dns/examples/PollingUsage.java)\n\nTo include the latest released version in your maven project, do:\n```xml\n  \u003cdependency\u003e\n    \u003cgroupId\u003ecom.spotify\u003c/groupId\u003e\n    \u003cartifactId\u003edns\u003c/artifactId\u003e\n    \u003cversion\u003e3.2.2\u003c/version\u003e\n  \u003c/dependency\u003e\n```\n\nNOTE: version 3.1.0 is broken; you cannot use the retention feature in that version.\n\n## License\n\nThis software is released under the Apache License 2.0. More information in the file LICENSE\ndistributed with this project.\n","funding_links":[],"categories":["网络编程"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotify%2Fdns-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspotify%2Fdns-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotify%2Fdns-java/lists"}