-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add noti in values.yaml, merge from main
- Loading branch information
Showing
50 changed files
with
866 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Account Service | ||
|
||
Account service is responsible for account-related operations, such as registration, profile management, log in/out, etc. | ||
|
||
## Events | ||
|
||
### Exchange | ||
|
||
- Name: account | ||
- Type: topic | ||
- Durable: true | ||
|
||
### Topic: updated | ||
|
||
- Description: A user has updated the profile with new information. | ||
- Message format: JSON-serialized item. | ||
|
||
```json | ||
{ | ||
{ | ||
"id": 1, | ||
"email": "[email protected]", | ||
"nickname": "mrcaidev", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/78269445?v=4", | ||
"department_id": 1, | ||
"phone_code": "65", | ||
"phone_number": "80843976", | ||
"preferred_currency": "CNY", | ||
"created_at": "2024-09-23 12:19:10.415264+00", | ||
"deleted_at": null | ||
} | ||
} | ||
``` | ||
|
||
### Topic: deleted | ||
|
||
- Description: A user has deleted the account. | ||
- Message format: Account ID. | ||
|
||
``` | ||
1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
services/account/src/main/java/edu/nus/market/config/RabbitMQConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package edu.nus.market.config; | ||
|
||
import jakarta.annotation.Resource; | ||
import org.springframework.amqp.core.*; | ||
import org.springframework.amqp.rabbit.connection.ConnectionFactory; | ||
import org.springframework.amqp.rabbit.core.RabbitTemplate; | ||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class RabbitMQConfig { | ||
// use Jackson2JsonMessageConverter to transfer the message JSON format | ||
@Bean | ||
public Jackson2JsonMessageConverter jsonMessageConverter() { | ||
return new Jackson2JsonMessageConverter(); | ||
} | ||
|
||
@Bean | ||
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) { | ||
RabbitTemplate template = new RabbitTemplate(connectionFactory); | ||
template.setMessageConverter(jsonMessageConverter()); | ||
return template; | ||
} | ||
|
||
// define account Topic exchange | ||
@Bean | ||
public TopicExchange topicExchange() { | ||
return new TopicExchange("account"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
services/account/src/main/java/edu/nus/market/pojo/ResEntity/UpdateMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package edu.nus.market.pojo.ResEntity; | ||
|
||
import edu.nus.market.pojo.Account; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class UpdateMessage { | ||
int id; | ||
|
||
String nickname; | ||
|
||
String avatarUrl; | ||
|
||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("UpdateMessage{") | ||
.append("id=").append(id) | ||
.append(", nickname='").append(nickname).append('\'') | ||
.append(", avatarUrl='").append(avatarUrl).append('\'') | ||
.append('}'); | ||
return sb.toString(); | ||
} | ||
|
||
// all args constructor, input an Account object, and convert to this UpdateMessage object | ||
public UpdateMessage(Account account) { | ||
this.id = account.getId(); | ||
this.nickname = account.getNickname(); | ||
this.avatarUrl = account.getAvatarUrl(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
services/account/src/main/java/edu/nus/market/service/MQService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package edu.nus.market.service; | ||
|
||
import edu.nus.market.pojo.ResEntity.UpdateMessage; | ||
|
||
public interface MQService { | ||
public void sendUpdateMessage(UpdateMessage message); | ||
public void sendDeleteMessage(String message); | ||
} |
Oops, something went wrong.