title: NGRX Effects - Where/How to organize effect definitions.
body: <p>I'm using @ngrx/effects in an angular2 application, and struggling with the organization of the different effect definitions.</p>
  
  <p>I have to entities, <code>Identity</code> and <code>Subscription</code>, each with their own Actions services <code>IdentityActions</code>, <code>SubscriptionActions</code>, as well as their effects services <code>IdentityEffects</code>, <code>SubscriptionEffects</code>. </p>
  
  <p>The following actions are defined.</p>
  
  <pre><code>IdentityActions.AuthorizeIdentity()
  IdentityActions.OnIdentityAuthorized(identity)
  SubscriptionActions.GetSubscriptionList(identity)
  SubscriptionACtions.OnSubscriptionsListed(subscriptions)
  </code></pre>
  
  <p>After an identity is authorized, I immediately want to get a list of it's subscriptions.  How does <code>@ngrx/effects</code> advocate the organization of these effects so that it is traceable/easy-to-find later (e.g. a year from now)?</p>
  
  <p>In IdentityEffects:</p>
  
  <pre><code>@Effect()
  this._actions.ofType(authActions.AUTHORIZE_IDENTITY))
    .switchMap(() =&gt; this.svc.AsyncAuth())
    .switchMap((identity) =&gt; authActions.OnIdentityAuthorized(identity))
  
  @Effect()
  this._actions.ofType(authActions.ON_IDENTITY_AUTHORIZED)
    .switchMap((identity) =&gt; Observable.of(action, subActions.GetSubscriptionList(identty)) 
  </code></pre>
  
  <p>This seems natural when writing it, because getting the subscription list is an effect of an identity getting authorized... but I'm concerned because if a developer is ever trying to track down where the subscription list is getting fetched from, it isn't intuitive to go digging around in the IdentityService.</p>
  
  <p>The alternative is to register a 2nd effect in CustomerEffects that doesn't emit..</p>
  
  <pre><code>@Effect({emit: false})
  this._actoions.ofType(authActions.ON_IDENTITY_AUTHORIZED)
    .switchMap((identity) =&gt; Observable.of(action, subActions.GetSubscriptionList(identity)) 
  </code></pre>
  
  <p>This seems like it would be easier to find in the long run... But feels less natural when writing it (I'm writing an identity side effect in the subscriptions service...)</p>
  
  <p>What is the time-tested approach (if there even exists enough time)?</p>