Skip to content

Instantly share code, notes, and snippets.

@lc-nyovchev
Created December 13, 2018 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lc-nyovchev/3f08647e186d8c663dfb6b15e5f4f045 to your computer and use it in GitHub Desktop.
Save lc-nyovchev/3f08647e186d8c663dfb6b15e5f4f045 to your computer and use it in GitHub Desktop.
@Service
public class SomeRouterService {
private final DispatcherService dispatcherService;
private final SomeDestination someDestination1;
private final SomeDestination someDestination2;
@Autowired
public SomeRouterService (
@NonNull DispatcherService dispatcherService,
@Qualifier("someDestination1") @NonNull SomeDestination someDestination1,
@Qualifier("someDestination2") @NonNull SomeDestination someDestination2) {
this.dispatcherService = dispatcherService;
this.someDestination1 = someDestination1;
this.someDestination2 = someDestination2;
}
public void onMessage(Message message) {
//..some code to route stuff based on something to either destination1 or destination2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment