mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
update bus example 1.x
This commit is contained in:
parent
eb72043b9f
commit
05a7e1a05d
@ -16,8 +16,6 @@
|
||||
*/
|
||||
package org.springframework.cloud.alibaba.cloud.examples.rocketmq;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@ -30,6 +28,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* RocketMQ Bus Spring Application
|
||||
*
|
||||
@ -75,7 +76,7 @@ public class RocketMQBusApplication {
|
||||
user.setId(System.currentTimeMillis());
|
||||
user.setName(name);
|
||||
publisher.publishEvent(
|
||||
new UserRemoteApplicationEvent(user, originService, destination));
|
||||
new UserRemoteApplicationEvent(this, user, originService, destination));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
*/
|
||||
package org.springframework.cloud.alibaba.cloud.examples.rocketmq;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
|
||||
|
||||
/**
|
||||
@ -28,16 +26,22 @@ import org.springframework.cloud.bus.event.RemoteApplicationEvent;
|
||||
*/
|
||||
public class UserRemoteApplicationEvent extends RemoteApplicationEvent {
|
||||
|
||||
private User user;
|
||||
|
||||
public UserRemoteApplicationEvent() {
|
||||
}
|
||||
|
||||
public UserRemoteApplicationEvent(User user, String originService,
|
||||
public UserRemoteApplicationEvent(Object source, User user, String originService,
|
||||
String destinationService) {
|
||||
super(user, originService, destinationService);
|
||||
super(source, originService, destinationService);
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public User getUser() {
|
||||
return (User) getSource();
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user