I’m creating activity object with the below code:
private final RetryOptions retryoptions = RetryOptions.newBuilder().setInitialInterval(Duration.ofSeconds(1))
.setMaximumInterval(Duration.ofSeconds(100)).setBackoffCoefficient(2).setMaximumAttempts(50000).build();
private final ActivityOptions options = ActivityOptions.newBuilder().setStartToCloseTimeout(Duration.ofSeconds(30000))
.setRetryOptions(retryoptions).build();
private final OrderActivities activity = Workflow.newActivityStub(OrderActivities.class, options);
private final RuleActivities ruleActivities = Workflow.newActivityStub(RuleActivities.class, options);
But, when I start up the application, I get the error:
Method threw 'java.lang.IllegalArgumentException' exception. Cannot evaluate com.sun.proxy.$Proxy53.toString()
I have already defined the bean implementations in a config file:
@Bean
public OrderActivitiesImpl SignUpActivity() {
return new OrderActivitiesImpl();
}
@Bean
public RuleActivitiesImpl ruleActivity() {
return new RuleActivitiesImpl();
}
Also, I have registered the activities in the starter:
@SpringBootApplication
public class ServiceApplication {
public static void main(String[] args) {
ConfigurableApplicationContext appContext = SpringApplication.run(ServiceApplication.class, args);
WorkerFactory factory = appContext.getBean(WorkerFactory.class);
OrderActivities orderActivity = appContext.getBean(OrderActivities.class);
RuleActivities ruleActivities = appContext.getBean(RuleActivities.class);
Worker worker = factory.newWorker(OrderWorkflow.QUEUE_NAME);
worker.registerWorkflowImplementationTypes(OrderWorkflowImpl.class);
worker.registerActivitiesImplementations(orderActivity,ruleActivities);
factory.start();
}
OrderActivities
interface →
@ActivityInterface
public interface OrderActivities {
@ActivityMethod
void placeOrder();
@ActivityMethod
void setOrderAccepted();
@ActivityMethod
void setOrderPickedUp();
@ActivityMethod
void setOrderDelivered();
}
RuleActivities
interface →
@ActivityInterface
public interface RuleActivities {
@ActivityMethod
Map<String, Map<String, Object>> fetchBusinessRules(Map<String,Object> input);
}
I’m not sure what is going wrong here as the error traces are not intuitive. The only hint available is that the error is thrown at Workflow.newActivityStub()
. Any tips would be highly appreciated. Thanks!