-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to KeyAndBuilderValuesHystrixPropertiesStrategy
- Loading branch information
Showing
5 changed files
with
32 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
app/com/m3/octoparts/hystrix/CachelessHystrixPropertiesStrategy.scala
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
app/com/m3/octoparts/hystrix/KeyAndBuilderValuesHystrixPropertiesStrategy.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.m3.octoparts.hystrix | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.netflix.hystrix.{ HystrixCommandKey, HystrixCommandProperties } | ||
import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy | ||
|
||
/** | ||
* Custom [[HystrixPropertiesStrategy]] implementation | ||
*/ | ||
class KeyAndBuilderValuesHystrixPropertiesStrategy extends HystrixPropertiesStrategy { | ||
private val mapper = new ObjectMapper() | ||
|
||
/** | ||
* Overriden to return a [[String]] that is a combination of the commandKey name and a JSON string | ||
* of the builder values | ||
*/ | ||
override def getCommandPropertiesCacheKey(commandKey: HystrixCommandKey, builder: HystrixCommandProperties.Setter): String = | ||
s"${commandKey.name()}-${mapper.writeValueAsString(builder)}" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters