BJ-988: Add ScheduledPreparationFlowService handler and servlet

This commit is contained in:
a.romanov 2020-09-18 12:06:30 +03:00 committed by a.romanov
parent c3552a4a6c
commit a2770efca7
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package com.rbkmoney.threeds.server.storage.handler;
import com.rbkmoney.damsel.schedule.ContextValidationResponse;
import com.rbkmoney.damsel.schedule.ExecuteJobRequest;
import com.rbkmoney.damsel.schedule.ScheduledJobExecutorSrv;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Service;
import java.nio.ByteBuffer;
@Slf4j
@Service
@RequiredArgsConstructor
public class ScheduledPreparationFlowServiceHandler implements ScheduledJobExecutorSrv.Iface {
@Override
public ContextValidationResponse validateExecutionContext(ByteBuffer byteBuffer) throws TException {
return null; // TODO [a.romanov]: impl
}
@Override
public ByteBuffer executeJob(ExecuteJobRequest executeJobRequest) throws TException {
return null; // TODO [a.romanov]: impl
}
}

View File

@ -0,0 +1,33 @@
package com.rbkmoney.threeds.server.storage.servlet;
import com.rbkmoney.damsel.schedule.ScheduledJobExecutorSrv;
import com.rbkmoney.threeds.server.storage.handler.ScheduledPreparationFlowServiceHandler;
import com.rbkmoney.woody.thrift.impl.http.THServiceBuilder;
import lombok.RequiredArgsConstructor;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
@RequiredArgsConstructor
@WebServlet("/three-ds-server-storage/scheduled-preparation-flow")
public class ScheduledPreparationFlowServiceServlet extends GenericServlet {
private final ScheduledPreparationFlowServiceHandler handler;
private Servlet servlet;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
servlet = new THServiceBuilder()
.build(ScheduledJobExecutorSrv.Iface.class, handler);
}
@Override
public void service(
ServletRequest request,
ServletResponse response) throws ServletException, IOException {
servlet.service(request, response);
}
}