Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mjolnir 1.6 #6

Merged
merged 12 commits into from
Feb 9, 2014
Merged

Mjolnir 1.6 #6

merged 12 commits into from
Feb 9, 2014

Conversation

robhruska
Copy link
Member

Minor updates (non-breaking):

  • Introduce ICommand<TResult> and apply to Command<TResult> so we can test things mo' better.
  • Stop logging command exceptions to avoid duplicate traces.
  • Drop the unit test execution time by about 20 seconds.

Major updates (non-breaking):

  • Ability to decorate an interface with a [Command] attribute to automatically proxy the call through a Command.

    Example:

    [BifrostService]
    [Command("recruit", "recruit-team", 15000)]
    public interface IRecruitTeamService
    {
        [BifrostPath("bifrost/recruit/recruit-team/get-team
        Task<RecruitTeamDto> GetTeam(long teamId);
    
        // ...
    }
    
    [Command("mongo", "recruiting-boards", 15000)]
    public interface IBoardDao
    {
        [CommandTimeout(5000)] // Allow base timeout to be overridden.
        BaseBoard GetBoardById(string id, long teamId);
    
        BaseBoard CreateBoard(BaseBoard board);
    
        // ...
    }
    
    • Right now, this will only work for interfaces whose implementations are grabbed via a service locator (e.g. Bifrost's ServiceLocator or DaoFactory).
    • I imagine the Bifrost ServiceLocator processing of the attributes will only apply the command proxy to calls that are going to be remote; it won't proxy if they're local.
    • The proxying supports both Task and non-Task return types. If the method returns a Task, it'll use InvokeAsync(). Otherwise it'll use Invoke().
    • We might be able to rethink CancellationTokens and whether or not we need to encourage them on Bifrost service methods now. Not sure here yet, haven't thought about it.

Side note - we'll probably want to change how we use ServiceLocator a bit to make it more testable. Callers should probably keep a local IServiceLocator that can be injected for unit testing.

robhruska added a commit that referenced this pull request Feb 9, 2014
@robhruska robhruska merged commit c7e955b into master Feb 9, 2014
@robhruska robhruska deleted the Platform_Mjolnir1dot6 branch February 9, 2014 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant