Skip to content

Commit

Permalink
Merge pull request #7 from clearlydecoded/development
Browse files Browse the repository at this point in the history
Fixes for version 2.0.0
  • Loading branch information
ychaikin authored Jul 16, 2018
2 parents fd1f028 + 5b3fc05 commit de2a99f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @author Yaakov Chaikin ([email protected])
*/
@Service
public class GingerCookieOrderHandler extends
public class GingerCookieOrderProcessor extends
AbstractMessageProcessor<GingerCookieOrder, GingerCookieOrderResponse> {

@SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
package com.clearlydecoded.messenger.demo.processor;

import com.clearlydecoded.messenger.MessageProcessor;
import com.clearlydecoded.messenger.AbstractMessageProcessor;
import com.clearlydecoded.messenger.demo.message.GreetMeMessage;
import com.clearlydecoded.messenger.demo.message.GreetMeMessageResponse;
import org.springframework.stereotype.Service;
Expand All @@ -19,31 +19,13 @@
* @author Yaakov Chaikin ([email protected])
*/
@Service // Must have this annotation for Spring to discover the class
public class GreetMeMessageProcessor implements
MessageProcessor<GreetMeMessage, GreetMeMessageResponse> {
public class GreetMeMessageProcessor extends
AbstractMessageProcessor<GreetMeMessage, GreetMeMessageResponse> {

@Override
public GreetMeMessageResponse process(GreetMeMessage message) {

// This is where you write the actual business logic
return new GreetMeMessageResponse("Hello " + message.getMyName());
}

@Override
public String getCompatibleMessageType() {
// SEE! Defining that TYPE as public static final paid off!
// You certainly CAN just hardcode a string here, but this is more robust.
// Don't worry, if you mess this up, the validation at startup will catch it
return GreetMeMessage.TYPE;
}

@Override
public Class<GreetMeMessage> getCompatibleMessageClassType() {
return GreetMeMessage.class; // not possible to mess up here
}

@Override
public Class<GreetMeMessageResponse> getCompatibleMessageResponseClassType() {
return GreetMeMessageResponse.class; // not possible to mess up here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author Yaakov Chaikin ([email protected])
*/
@Service
public class MaxSugarOrderHandler extends
public class MaxSugarOrderProcessor extends
AbstractMessageProcessor<MaxSugarOrder, MaxSugarOrderResponse> {

@SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
package com.clearlydecoded.messenger.demo.processor;

import com.clearlydecoded.messenger.AbstractMessageProcessor;
import com.clearlydecoded.messenger.MessageProcessor;
import com.clearlydecoded.messenger.demo.message.SugarComaCookieOrder;
import com.clearlydecoded.messenger.demo.message.SugarComaCookieOrderResponse;
import com.clearlydecoded.messenger.demo.model.Cookie;
Expand All @@ -22,9 +22,9 @@
*
* @author Yaakov Chaikin ([email protected])
*/
@Service
public class SugarComaCookieOrderProcessor extends
AbstractMessageProcessor<SugarComaCookieOrder, SugarComaCookieOrderResponse> {
@Service // Must have this annotation for Spring to discover the class
public class SugarComaCookieOrderProcessor implements
MessageProcessor<SugarComaCookieOrder, SugarComaCookieOrderResponse> {

@SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection")
@Autowired
Expand All @@ -33,7 +33,26 @@ public class SugarComaCookieOrderProcessor extends

@Override
public SugarComaCookieOrderResponse process(SugarComaCookieOrder message) {
// This is where you write the actual business logic
Cookie comaCookie = cookieStoreService.giveMeSugarComaCookie();
return new SugarComaCookieOrderResponse(comaCookie);
}

@Override
public String getCompatibleMessageType() {
// SEE! Defining that TYPE as public static final paid off!
// You certainly CAN just hardcode a string here, but this is more robust.
// Don't worry, if you mess this up, the validation at startup will catch it
return SugarComaCookieOrder.TYPE;
}

@Override
public Class<SugarComaCookieOrder> getCompatibleMessageClassType() {
return SugarComaCookieOrder.class; // not possible to mess up here
}

@Override
public Class<SugarComaCookieOrderResponse> getCompatibleMessageResponseClassType() {
return SugarComaCookieOrderResponse.class; // not possible to mess up here
}
}

0 comments on commit de2a99f

Please sign in to comment.