代码之家  ›  专栏  ›  技术社区  ›  valik

如何使用spring boot订阅/跟踪用户

  •  0
  • valik  · 技术社区  · 7 年前

    我有两个实体BlogPost和用户im不确定下面的机制是如何工作的,我已经在S.O上搜索过了,但是没有得到一个主意

    我的想法

    我认为follow是某种 Get posts where userID = ? 但它也应该是一个持续的过程,即当用户再次发帖时,它应该自动获得新的帖子,直到用户展开。

    我想就如何实施和我需要什么提出一些建议。

    我想创造的东西 我想创建一个订阅用户的服务(比如在linkedIn这样的社交网络中,这样用户就可以通过让所有用户获得新的活动,比如新的帖子(新的上传)来跟踪另一个用户

    public void subscribeToUser(String id){
        //follow a user by id 
        //im not sure the relationship i should create between the entities 
        // user and posts so that when one user creates a post 
        // another user can subscribe to the first user and can see all the posts and future posts of the user
    }
    

    }

    0 回复  |  直到 7 年前