anchor.diff:  -spec subscribe(Pid:: pid(),TopicUri :: binary(), Options :: map(), Session::term(), State :: record(state)) ->
     {ok, ID::non_neg_integer()} | {error, Reason :: term()}.
   subscribe(Pid,TopicUri,Options,Session,#state{ets=Ets}=State) ->
  -  case maps:get(match,Options,exact) of
  +  Match = maps:get(match,Options,exact),
  +  case Match of
       prefix ->
         {error,not_supported};
       wildcard ->
         {error,not_supported};
       exact ->
  -      SubscriptionId = case ets:lookup(Ets,TopicUri) of
  -                         [#topic{id=SID,subscribers=Subs}=T] ->
  -                           NewSubs = [Pid|lists:delete(Pid,Subs)],
  -                           ets:insert(Ets,T#topic{subscribers=NewSubs}),
  -                           SID;
  -                         [] ->
  -                           {ok,SID} = create_topic(TopicUri,[Pid],State),
  -                           SID
  -                       end,
  +      {SubscriptionId,Created,TopicDetails} = case ets:lookup(Ets,TopicUri) of
  +                                                [#topic{id=SID,subscribers=Subs}=T] ->
  +                                                  NewSubs = [Pid|lists:delete(Pid,Subs)],
  +                                                  ets:insert(Ets,T#topic{subscribers=NewSubs}),
  +                                                  {SID,false,not_needed};
  +                                                [] ->
  +                                                  {ok,SID,TDetails} = create_topic(TopicUri,Match,[Pid],State),
  +                                                  {SID,true,TDetails}
  +                                              end,
         ok = add_topic_to_pid(TopicUri,Pid,Session,State),
  +      SessionId = erwa_session:get_id(Session),
  +      case Created of
  +        true ->
  +          publish_metaevent(on_create,TopicUri,SessionId,TopicDetails,State);
  +        false -> nothing
  +      end,
  +      publish_metaevent(on_subscribe,TopicUri,SessionId,SubscriptionId,State),
         {ok,SubscriptionId}
     end.
   
  
positive.code:                 uri = unknown,
                  id = none,
                  match = exact,
                  subscribers = []}).
  
  -record(id_topic, {
  
negative.code:       ok = remove_topic_from_pid(TopicUri,Pid,State),
        true = ets:delete(Ets,SubscriptionId),
        true = ets:delete(Ets,TopicUri),
        publish_metaevent(on_unsubscribe,TopicUri,SessionId,SubscriptionId,State),
        publish_metaevent(on_delete,TopicUri,SessionId,SubscriptionId,State),
        ok;
      {true,NewSubs} ->
        ok = remove_topic_from_pid(TopicUri,Pid,State),
        true = ets:insert(Ets,T#topic{subscribers=NewSubs}),
        publish_metaevent(on_unsubscribe,TopicUri,SessionId,SubscriptionId,State),
        ok
    end.
  
  