Skip to content

Commit

Permalink
Merge pull request #1616 from dmgcodevil/iss1600
Browse files Browse the repository at this point in the history
iss1600: Wrong hystrix event type for fallback missing
  • Loading branch information
mattrjacobs authored Jul 3, 2017
2 parents 1460419 + 0021399 commit 5e470b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,6 @@ Object process(Action action) throws Exception {
@Override
protected abstract T run() throws Exception;

/**
* {@inheritDoc}.
*/
@Override
protected T getFallback() {
throw new RuntimeException("No fallback available.", getExecutionException());
}

/**
* Clears cache for the specified hystrix command.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,24 @@ public void testCommandThrowsHystrixBadRequestExceptionWithNoCause() {
}
}

@Test
public void testFallbackMissing(){
try {
userService.getUserWithoutFallback(null, null);
} catch (Exception e) {}

HystrixInvokableInfo<?> command = getHystrixCommandByKey("getUserWithoutFallback");
assertTrue("expected event: FALLBACK_MISSING", command.getExecutionEvents().contains(HystrixEventType.FALLBACK_MISSING));
}

public static class UserService {

@HystrixCommand
public User getUserWithoutFallback(final String id, final String name) {
validate(id, name);
return new User(id, name);
}

@HystrixCommand(fallbackMethod = "fallback")
public Future<User> getUserAsync(final String id, final String name) {
validate(id, name); // validate logic can be inside and outside of AsyncResult#invoke method
Expand Down

0 comments on commit 5e470b5

Please sign in to comment.