|
The publish annotations for service operations are generated twice.
Previous workaround suggestion doesn't work.
A better workaround is to add the following to src/main/resources/templates/SpecialCases.xpt: «REM»Workaround for «AROUND templates::PubSub::publishAnnotation FOR Publish» «ENDAROUND» «REM»Workaround for «AROUND templates::Service::serviceMethodAnnotation FOR ServiceOperation» «targetDef.proceed()» «IF publish != null»«EXPAND fixedPublishAnnotation FOR publish»«ENDIF-» «ENDAROUND» «REM»Workaround for «DEFINE fixedPublishAnnotation FOR Publish» «LET eventType == null ? null : eventType.getDomainPackage() + "." + eventType.name + ".class" AS eventTypeClass-» «formatAnnotationParameters("@" + fw("event.annotation.Publish"), { eventTypeClass != null, "eventType", eventTypeClass, topic != null, "topic", '"' + topic + '"', eventBus != null, "eventBus", '"' + eventBus + '"' }) -» «ENDLET-» «ENDDEFINE» Even better, add the following to src/main/resources/templates/SpecialCases.xpt:
«REM»Workaround for «AROUND templates::PubSub::publishAnnotation FOR Publish» «ENDAROUND» «REM»Workaround for «AROUND templates::Service::serviceMethodAnnotation FOR ServiceOperation» «targetDef.proceed()» «IF publish != null»«EXPAND fixedPublishAnnotation FOR publish»«ENDIF-» «ENDAROUND» «REM»Workaround for «AROUND templates::Repository::repositoryMethodAnnotation FOR RepositoryOperation» «targetDef.proceed()» «IF publish != null»«EXPAND fixedPublishAnnotation FOR publish»«ENDIF-» «ENDAROUND» «REM»Workaround for «DEFINE fixedPublishAnnotation FOR Publish» «LET eventType == null ? null : eventType.getDomainPackage() + "." + eventType.name + ".class" AS eventTypeClass-» «formatAnnotationParameters("@" + fw("event.annotation.Publish"), { eventTypeClass != null, "eventType", eventTypeClass, topic != null, "topic", '"' + topic + '"', eventBus != null, "eventBus", '"' + eventBus + '"' }) -» «ENDLET-» «ENDDEFINE» |
|||||||||||||||||||||||||||||||||||||||||||||
A workaround until we fix the bug is to define the eventType excplicity:
@EmployeeHired recordHire(DateTime occurred, @Employee employee) publish EmployeeHired to employeeChannel;