Skip to content

Commit

Permalink
add logging for sent events
Browse files Browse the repository at this point in the history
  • Loading branch information
stCarolas committed Jun 15, 2024
1 parent 2dbb892 commit 0871540
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,39 @@ public String getType() {
public Widget getWidget() {
return widget;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((widget == null) ? 0 : widget.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
WidgetChangedEvent other = (WidgetChangedEvent) obj;
if (type == null) {
if (other.type != null) return false;
} else if (!type.equals(other.type)) return false;
if (widget == null) {
if (other.widget != null) return false;
} else if (!widget.equals(other.widget)) return false;
return true;
}

@Override
public String toString() {
return (
"{\"_type\"=\"WidgetChangedEvent\",\"type\"=\"" +
type +
"\", widget\"=\"" +
widget +
"}"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@

import io.micronaut.rabbitmq.annotation.Binding;
import io.micronaut.rabbitmq.annotation.RabbitClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@RabbitClient(WidgetRabbitConfiguration.CHANGES_WIDGETS)
public interface WidgetChangedNotificationSender {
void send(@Binding String binding, WidgetChangedEvent event);
static Logger log = LoggerFactory.getLogger(
WidgetChangedNotificationSender.class
);
void _send(@Binding String binding, WidgetChangedEvent event);

public default void send(String binding, WidgetChangedEvent event) {
log.info("Send event: {}", event);
this._send(binding, event);
}
}

0 comments on commit 0871540

Please sign in to comment.