Skip to content

Commit

Permalink
changes Consumers to be Serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
buritos committed Jan 30, 2020
1 parent d5f3dd8 commit adba08a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package io.vlingo.frontservice.infra.persistence;

import java.util.Collection;
import java.util.function.Consumer;

import io.vlingo.actors.Actor;
import io.vlingo.actors.DeadLetter;
import io.vlingo.actors.LocalMessage;
import io.vlingo.actors.Mailbox;
import io.vlingo.actors.Returns;
import io.vlingo.actors.*;
import io.vlingo.common.BasicCompletes;
import io.vlingo.common.Completes;
import io.vlingo.common.SerializableConsumer;
import io.vlingo.frontservice.data.ProfileData;
import io.vlingo.frontservice.data.UserData;

import java.util.Collection;

public class Queries__Proxy implements Queries {

private static final String profileOfRepresentation1 = "profileOf(java.lang.String)";
Expand All @@ -29,7 +25,7 @@ public Queries__Proxy(final Actor actor, final Mailbox mailbox){

public Completes<ProfileData> profileOf(java.lang.String arg0) {
if (!actor.isStopped()) {
final Consumer<Queries> consumer = (actor) -> actor.profileOf(arg0);
final SerializableConsumer<Queries> consumer = (actor) -> actor.profileOf(arg0);
final Completes<io.vlingo.frontservice.data.ProfileData> completes = new BasicCompletes<>(actor.scheduler());
mailbox.send(new LocalMessage<Queries>(actor, Queries.class, consumer, Returns.value(completes), profileOfRepresentation1));
return completes;
Expand All @@ -40,7 +36,7 @@ public Completes<ProfileData> profileOf(java.lang.String arg0) {
}
public Completes<UserData> userDataOf(java.lang.String arg0) {
if (!actor.isStopped()) {
final Consumer<Queries> consumer = (actor) -> actor.userDataOf(arg0);
final SerializableConsumer<Queries> consumer = (actor) -> actor.userDataOf(arg0);
final Completes<io.vlingo.frontservice.data.UserData> completes = new BasicCompletes<>(actor.scheduler());
mailbox.send(new LocalMessage<Queries>(actor, Queries.class, consumer, Returns.value(completes), userDataOfRepresentation2));
return completes;
Expand All @@ -51,7 +47,7 @@ public Completes<UserData> userDataOf(java.lang.String arg0) {
}
public Completes<Collection<UserData>> usersData() {
if (!actor.isStopped()) {
final Consumer<Queries> consumer = (actor) -> actor.usersData();
final SerializableConsumer<Queries> consumer = (actor) -> actor.usersData();
final Completes<Collection<UserData>> completes = new BasicCompletes<>(actor.scheduler());
mailbox.send(new LocalMessage<Queries>(actor, Queries.class, consumer, Returns.value(completes), usersDataRepresentation3));
return completes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@

package io.vlingo.frontservice.model;

import java.util.function.Consumer;

import io.vlingo.actors.Actor;
import io.vlingo.actors.DeadLetter;
import io.vlingo.actors.LocalMessage;
import io.vlingo.actors.Mailbox;
import io.vlingo.actors.Returns;
import io.vlingo.actors.*;
import io.vlingo.common.BasicCompletes;
import io.vlingo.common.Completes;
import io.vlingo.common.SerializableConsumer;

public class User__Proxy implements User {

Expand All @@ -34,15 +29,15 @@ public User__Proxy(final Actor actor, final Mailbox mailbox){
@Override
public void attachPrivateToken(String arg0) {
if (!actor.isStopped()) {
final Consumer<User> consumer = (actor) -> actor.attachPrivateToken(arg0);
final SerializableConsumer<User> consumer = (actor) -> actor.attachPrivateToken(arg0);
mailbox.send(new LocalMessage<User>(actor, User.class, consumer, null, attachPrivateToken1));
} else {
actor.deadLetters().failedDelivery(new DeadLetter(actor, attachPrivateToken1));
}
}
public Completes<UserState> withContact(Contact arg0) {
if (!actor.isStopped()) {
final Consumer<User> consumer = (actor) -> actor.withContact(arg0);
final SerializableConsumer<User> consumer = (actor) -> actor.withContact(arg0);
final Completes<UserState> completes = new BasicCompletes<>(actor.scheduler());
mailbox.send(new LocalMessage<User>(actor, User.class, consumer, Returns.value(completes), withContactRepresentation2));
return completes;
Expand All @@ -53,7 +48,7 @@ public Completes<UserState> withContact(Contact arg0) {
}
public Completes<UserState> withName(Name arg0) {
if (!actor.isStopped()) {
final Consumer<User> consumer = (actor) -> actor.withName(arg0);
final SerializableConsumer<User> consumer = (actor) -> actor.withName(arg0);
final Completes<UserState> completes = new BasicCompletes<>(actor.scheduler());
mailbox.send(new LocalMessage<User>(actor, User.class, consumer, Returns.value(completes), withNameRepresentation3));
return completes;
Expand Down

0 comments on commit adba08a

Please sign in to comment.