1
有沒有方法可以在不使用REST操作的情況下從Eureka服務器中刪除已註冊的實例?哪個是包含所有應用程序的數據結構?以編程方式從Eureka服務器刪除已註冊的實例
(很明顯,我想刪除它們在Eureka服務器中編寫代碼)。
感謝,
納米
有沒有方法可以在不使用REST操作的情況下從Eureka服務器中刪除已註冊的實例?哪個是包含所有應用程序的數據結構?以編程方式從Eureka服務器刪除已註冊的實例
(很明顯,我想刪除它們在Eureka服務器中編寫代碼)。
感謝,
納米
你是後功能可通過InstanceRegistry
,其本身只是Netflix的尤里卡類(PeerAwareInstanceRegistryImpl
和AbstractInstanceRegistry
)的延伸。
具體而言,AbstractInstanceRegistry#cancel(String,String,boolean)
方法應該從註冊表中刪除應用程序。
此方法狀態的Javadoc:
/**
* Cancels the registration of an instance.
*
* <p>
* This is normally invoked by a client when it shuts down informing the
* server to remove the instance from traffic.
* </p>
*
* @param appName the application name of the application.
* @param id the unique identifier of the instance.
* @param isReplication true if this is a replication event from other nodes, false
* otherwise.
* @return true if the instance was removed from the {@link AbstractInstanceRegistry} successfully, false otherwise.
*/
這是你將如何從尤里卡服務器本身實現這一目標。