Iam trying to generate ProductionOrder_OB report through Event-Based IntegrationSubscriptions. I have added the SysIdOutboundInterfaceWriteRequest in order to generate the outbound data. here is my code below
public void sendOutboundInterfaceWriteRequest(ActionBasedWorkflowContext<ProductionOrder> context) { for (ProductionOrder ProdOrder : context.getCurrent().getModels()) { ModelDataService modelDataService = Services.get(ModelDataService.class); ProductionOrder currentProductionOrder = modelDataService.readById(ProductionOrder.class, ProdOrder.getSysId(), context.getPlatformUserContext()); OutboundMessageService outboundService = Services.get(OutboundMessageService.class); QueueRef queueRef = QueueRefImpl.create(context.getPlatformUserContext().getValueChainId(), null, "Outbox/EXPORT_PRODUCTION_ORDER"); SysIdOutboundInterfaceWriteRequest sysIdOutboundInterfaceWriteRequest = new SysIdOutboundInterfaceWriteRequest( "MFG.ProductionOrder_OB", "2.0", queueRef, ListUtil.create(currentProductionOrder.getSysId()), null); try { outboundService.writeSysIdBasedOutbound(sysIdOutboundInterfaceWriteRequest, context.getPlatformUserContext()); } catch (Exception e) { LOG.error("Failed to send Production Order", e); } } }
Here is my ProductionOrder_OB
I have also set up PLT.MessageRoute_IB.csv, PLT.MessageQue_IB.csv and pLT.MessageDestination_IB.csv. So here, Iam getting OB report even I disable subscription.
It looks like you are explicitly enqueuing to a hardcoded queue. Instead, you should be letting the IntegrationSubscription model drive this. The module code should not even be present. Instead, you should create an IntegrationSubscription record which chooses which events to subscribe to and what queue to deliver to.
Thank you Greg for the suggestion, and I delete the module code as well as hardcoded queue and then create an IntegrationSubscription record which chooses which events to subscribe. That solve my problem.