The generics in the signature need to match. A GoogleCloudStorageFileOutput takes a ByteBuffer while a DatastoreOutput takes an Entity. So depending on what type is emitted by AccountCounterReducer, you'll need to select an output that matches that type.
app engine map reduce java could not compile MapReduceSpecification.of
-
17-07-2023 - |
문제
I am unable to compile MapReduceSpecification.of .It does work when i select //new DatastoreOutput(1)), but incase of new GoogleCloudStorageFileOutput("images.sb.a-cti.com/staging/test", "result.txt", "text/plain", 1)), . This show compile error not sure if i am missing something .
I have tried replacing with different Marshallers but the result was same .
Could some one put some light on this.
@RequestMapping("/accountJDOCounter")
public void accountJDOCounter(HttpServletRequest request, HttpServletResponse response){
try{
String entityClassName = request.getParameter("entityClassName");
String entityKind = request.getParameter("entityKind");
if(entityKind == null){
response.getWriter().write("Error");
return;
}
MapReduceSettings settings = new MapReduceSettings().setWorkerQueueName("default").setControllerQueueName("default").setBuck etName("images.sb.a-cti.com/staging/test");
logger.info("Creating job15");
String jobId = MapReduceJob.start(
MapReduceSpecification.of(
"AccountJDO",
new DatastoreInput(entityKind, 10),
new AccountCounterMapper(),
Marshallers.getStringMarshaller(),
Marshallers.getLongMarshaller(),
new AccountCounterReducer(),
//new InMemoryOutput<KeyValue<String, Long>>(2)),
new GoogleCloudStorageFileOutput("images.sb.a-cti.com/staging/test", "result.txt", "text/plain", 1)),
//new DatastoreOutput(1)),
settings);
// jobId is used to monitor, see step 5) below
response.getWriter().write("jobId " + jobId);
logger.info("JobId " + jobId);
}catch(Exception e){
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
logger.info("Error " + sw.toString());
}
}
Error detail: Multiple markers at this line
- The method of(String, Input, Mapper, Marshaller, Marshaller, Reducer, Output) in the type MapReduceSpecification is not
applicable for the arguments (String, DatastoreInput, AccountCounterMapper, Marshaller, Marshaller, AccountCounterReducer,
InMemoryOutput>)
- The method of(String, Input, Mapper, Marshaller, Marshaller, Reducer, Output) in the type MapReduceSpecification is not
applicable for the arguments (String, DatastoreInput, AccountCounterMapper, Marshaller, Marshaller, AccountCounterReducer,
GoogleCloudStorageFileOutput)
Thanks in advance.
해결책