public void DispatchSoftVersion( [EventHubTrigger(Const.MessageSchemaId.MS025, Connection = Const.ConnectionString.EventHubsConnectionStringMs025)] string eventData, ILogger log) { log.EnterJson("EventData: {0}", new object[] { eventData }); Result result = null; DispatchedEvent[] dispatchedEvents = null; void actionIfFailedWhenStoreUnexpected(Exception ex, string json) => log.Error(ex, nameof(Resources.CO_DSP_DSV_003), new object[] { json }); try { try { dispatchedEvents = GetDispatchedEvents(eventData, log); } catch (Exception e) { // イベント情報が正常に読み解けなかった場合 log.Error(e, nameof(Resources.CO_DSP_DSV_006)); StoreUnexpectedEvent(Const.MessageSchemaId.MS025, eventData, actionIfFailedWhenStoreUnexpected); return; } foreach (DispatchedEvent dispatchedEvent in dispatchedEvents) { var messageId = dispatchedEvent?.MessageId; try { RmsEvent rmsEvent = ConvertEventDataToRmsEvent(dispatchedEvent); if (rmsEvent == null) { // イベントに必要なデータが不足している場合 log.Error(nameof(Resources.CO_DSP_DSV_006)); StoreUnexpectedEvent(Const.MessageSchemaId.MS025, dispatchedEvent.RawBody, actionIfFailedWhenStoreUnexpected, messageId); continue; } result = _service.StoreSoftVersion(rmsEvent); if (!result.IsSuccess()) { StoreUnexpectedEvent(Const.MessageSchemaId.MS025, dispatchedEvent.RawBody, actionIfFailedWhenStoreUnexpected, messageId); } } catch (Exception e) { log.Error(e, nameof(Resources.CO_DSP_DSV_001)); StoreUnexpectedEvent(Const.MessageSchemaId.MS025, dispatchedEvent.RawBody, actionIfFailedWhenStoreUnexpected, messageId); } } } finally { log.LeaveJson("Response: {0}", result); } }