Bảo Ngô
2 question(s)
0 answer(s)
Avatar
0
Bảo Ngô Beginner
Bảo Ngô Beginner
Ý nghĩa 1 số annotation trong ezyfox library
<div class="markdown-block">Hi a, e thấy có annotation này @EzyObjectBinding(write = false). E muốn hỏi mục đích của nó là gì và read, write = false vs true khác nhau ntn. Với lại a có document nào liệt kê các annotation thường dùng ko?</div>
Answer
Avatar
0
Bảo Ngô Beginner
Bảo Ngô Beginner
Bàn về cách ezy trả response
<div class="markdown-block">@Overrideprotected void execute() throws EzyBadRequestException {if (message.length() &gt; 255) {throw new EzyBadRequestException(ChatErrors.MESSAGE_TOO_LONG, "message too long");}ChatChannelUsers channelUsers =channelUserService.getChannelUsers(channelId, user.getName());if (channelUsers == null) {throw new EzyBadRequestException(ChatErrors.CHANNEL_NOT_FOUND, "channel with id: " + channelId + " not found");}messageService.save(new ChatMessage(maxIdService.incrementAndGet(ChatEntities.CHAT_MESSAGE),true, message, channelId, user.getName(), clientMessageId));responseFactory.newObjectResponse().command(CHAT_USER_MESSAGE).param("from", user.getName()).param("message", message).param("channelId", channelId).usernames(channelUsers.getUsers()).execute();}Đoạn code trên xử lý request và gửi response cho user. Tuy nhiên e có thắc mắc là tại sao mình ko thiết kế để return 1 cái response entity (ví dụ bên spring) hoặc 1 dto màcác lại return void và để việc response cho developer?Nếu như e có 1 concurrent map/list để cache user lại và sau đó bốc bừa 1 vài user ra để gửi thì sẽ có vấn đề không?Tệ hơn nữa, nếu e cache lại responseFactory và dùng nó cùng với list user để spam message thì có ổn k</div>
Answer