2014-05-12 2 views
0

매우 간단한 설정으로 제작자가 이벤트를 게시하고 단일 가입자로 처리 할 수 ​​있습니다. 두 역할 모두 저장소 큐를 전송으로 사용하여 Azure에서 호스팅됩니다. 이 제조자의 설정입니다 :NserviceBus 가입자가 Azure에서 호스팅되지 않습니다.

<connectionStrings> 
    <add name="NServiceBus/Transport" connectionString="UseDevelopmentStorage=true" /> 
</connectionStrings> 

<AzureProfileConfig Profiles="NServiceBus.Development" /> 
<AzureSubscriptionStorageConfig ConnectionString="UseDevelopmentStorage=true" /> 

<AuditConfig QueueName="audit" /> 
<UnicastBusConfig> 
    <MessageEndpointMappings> 
    <add Assembly="Interfaces" Type="Interfaces.SumbitOrder" Endpoint="Producer" /> 
    </MessageEndpointMappings> 
</UnicastBusConfig> 

이벤트는 평소와 같이 정의된다 :

public class EndpointConfig : IConfigureThisEndpoint, AsA_Worker, UsingTransport<AzureStorageQueue>, IWantCustomInitialization 
{ 
    public void Init() 
    { 
     Configure.Transactions.Disable(); 
     Configure.With() 
       .DefaultBuilder() 
       .UnicastBus() 
       .LoadMessageHandlers(); 


    } 
} 

과의 app.config :

public class SumbitOrder : IEvent 
{ 
    public string Name { get; set; } 
} 

출판

public class EndpointConfig : IConfigureThisEndpoint, AsA_Worker, UsingTransport<AzureStorageQueue>, IWantCustomInitialization 
{ 
    public void Init() 
    { 
     Configure.Transactions.Disable(); 
     Configure.With() 
       .DefaultBuilder() 
       .UnicastBus(); 

    } 
} 

이 가입자 설정입니다 이벤트의 처럼이야 다른 :

Bus.Publish(Bus.CreateInstance<SumbitOrder>(m => { m.Name = "sample order"; })); 

그래서 콘솔에 다음과 같은 메시지가 출력 볼 수있는 축복하는 인텔리 스트림 검색 : 보낸 사람의 ID를 0d46873c-102E-4d2a-b2a8-a3290097836a와 "수신 메시지 :

콘솔을 [4892]

: 9시 11분 40초 스레드 2014년 5월 12일 송신자 Subscriber1 @ UseDevelopmentStorage = TRUE " 시간에서의 ID 0d46873c 내지 102e-4d2a-b2a8-a3290097836a와 Subscriber1 @ UseDevelopmentStorage = TRUE" 콘솔 출력 "수신 메시지

콘솔 : "Subscriber1 @ UseDev 구독 elopmentStorage = 메시지 유형에 참 Interfaces.SumbitOrder, Interfaces.SumbitOrder, Interfaces.SumbitOrder, Interfaces.Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null " 콘솔 출력"메시지 유형 Interfaces.SumbitOrder, 인터페이스, 버전 = 1.0.0.0에 Subscriber1 @ UseDevelopmentStorage 등록 = , 문화 = 중립, PublicKeyToken = null ". 시간 : 2014년 5월 12일 9시 11분 40초 스레드 [4892]

또한 I 제조자 입력 큐에 동일한 메시지를 볼 수

{ 
    "IdForCorrelation": null, 
    "Id": "0d46873c-102e-4d2a-b2a8-a3290097836a", 
    "MessageIntent": 3, 
    "ReplyToAddress": "[email protected]=true", 
    "TimeToBeReceived": "10675199.02:48:05.4775807", 
    "Headers": { 
    "NServiceBus.MessageId": "0d46873c-102e-4d2a-b2a8-a3290097836a", 
    "NServiceBus.CorrelationId": "0d46873c-102e-4d2a-b2a8-a3290097836a", 
    "NServiceBus.OriginatingEndpoint": "Subscriber1", 
    "$.diagnostics.originating.hostid": "3814ca7177296375c232c8d0293664dc", 
    "NServiceBus.MessageIntent": "Subscribe", 
    "NServiceBus.Version": "4.6.1", 
    "NServiceBus.TimeSent": "2014-05-12 06:11:38:591761 Z", 
    "NServiceBus.OriginatingMachine": "VALDIS-MAC", 
    "NServiceBus.ControlMessage": "True", 
    "SubscriptionMessageType": "Interfaces.SumbitOrder, Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" 
    }, 
    "Body": null, 
    "CorrelationId": "0d46873c-102e-4d2a-b2a8-a3290097836a", 
    "Recoverable": true 
} 

가입자가 가입 저장 테이블까지 기록된다. 그러나 일반 메시징 (Bus.Send를)하고있다

namespace Subscriber1 
{ 
    public class SubmitOrderHandler : IHandleMessages<SumbitOrder> 
    { 
     public void Handle(SumbitOrder message) 
     { 
      // logic 
     } 
    } 
} 

- 그래서이 두 푸른 역할 사이의 연결 및 실행 : 그러나 이벤트 핸들러가 호출되지 없구요. 어디서 문제가 확실하지 그리고 난이이 문제에 관련이 있는지 여부를 몰라하지만 디버깅하는 동안 나는 Bus.Publish 라인에 다음과 같은 예외 볼 수 있습니다 NServiceBus.Core 어셈블리에 InvalidOperationException에 결과

Microsoft.Data.OData.ODataException: Cannot convert a primitive value to the expected type 'Edm.DateTime'. See the inner exception for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object. 
    at System.Xml.Schema.XsdDateTime.Parser.ParseTime(Int32& start) 
    at System.Xml.Schema.XsdDateTime.Parser.ParseTimeAndZoneAndWhitespace(Int32 start) 
    at System.Xml.Schema.XsdDateTime.Parser.Parse(String text, XsdDateTimeFlags kinds) 
    at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds) 
    at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption) 
    at Microsoft.Data.OData.PlatformHelper.ConvertStringToDateTime(String text) 
    at Microsoft.Data.OData.JsonLight.ODataJsonLightReaderUtils.ConvertStringValue(String stringValue, Type targetType) 
    at Microsoft.Data.OData.JsonLight.ODataJsonLightReaderUtils.ConvertValue(Object value, IEdmPrimitiveTypeReference primitiveTypeReference, ODataMessageReaderSettings messageReaderSettings, ODataVersion version, Boolean validateNullValue, String propertyName) 
    --- End of inner exception stack trace --- 
    at Microsoft.Data.OData.JsonLight.ODataJsonLightReaderUtils.ConvertValue(Object value, IEdmPrimitiveTypeReference primitiveTypeReference, ODataMessageReaderSettings messageReaderSettings, ODataVersion version, Boolean validateNullValue, String propertyName) 



Inner exceptoin: 
System.NullReferenceException: Object reference not set to an instance of an object. 
    at System.Xml.Schema.XsdDateTime.Parser.ParseTime(Int32& start) 
    at System.Xml.Schema.XsdDateTime.Parser.ParseTimeAndZoneAndWhitespace(Int32 start) 
    at System.Xml.Schema.XsdDateTime.Parser.Parse(String text, XsdDateTimeFlags kinds) 
    at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds) 
    at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption) 
    at Microsoft.Data.OData.PlatformHelper.ConvertStringToDateTime(String text) 
    at Microsoft.Data.OData.JsonLight.ODataJsonLightReaderUtils.ConvertStringValue(String stringValue, Type targetType) 
    at Microsoft.Data.OData.JsonLight.ODataJsonLightReaderUtils.ConvertValue(Object value, IEdmPrimitiveTypeReference primitiveTypeReference, ODataMessageReaderSettings messageReaderSettings, ODataVersion version, Boolean validateNullValue, String propertyName) 

을 . 그러나 스택 추적에서 최종 공개 메소드를 호출 수동으로 성공의 :

XmlConvert.ToDateTime("2014-05-11T20:42:01.15Z", XmlDateTimeSerializationMode.RoundtripKind); 

호출 스택에 NServiceBus에서 마지막 방법은 다음과 같습니다 NServiceBus.Azure.dll!NServiceBus.Unicast.Subscriptions.AzureSubscriptionStorage.NServiceBus.Unicast.Subscriptions.MessageDrivenSubscriptions.ISubscriptionStorage.Subscribe(NServiceBus.Address address = {unknown}, System.Collections.Generic.IEnumerable<NServiceBus.Unicast.Subscriptions.MessageType> messageTypes = {unknown}).

사내에서 호스팅 된 전송과 동일한 Azure 저장소 큐를 사용한 동일한 설정이 효과적인지 확인할 수 있습니다. 따라서 에뮬레이터에서 역할이 호스팅되는 방식이나 저장소 에뮬레이터의 작동 방식과 관련된 것이 있어야합니다.

이 아니라 현재 펍/서브 시나리오는 실패를 진단하는 데 도움이 바랍니다 우리가 결정 과정에 대한 관리에 전체 샘플을 시연하는이 쇼 스토퍼입니다! 테이블 저장 부로부터 가입 데이터를 읽을 때 Microsoft.Data.OData 라이브러리 내부 null 참조 예외가처럼 보이는 스택 트레이스에서

답변

0

.

어떤 버전의 당신은에입니까? 그리고 아마도 테이블 내용을 보면 날짜 필드 중 하나에 null 값이 있는지 알 수 있습니까?

+0

나는 푸른 SDK 2.3 WindowsAzure.Storage 3.1.0.1을 사용하고 있습니다. DateTime이있는 열은 null입니다. 스토리지 클라이언트 라이브러리의 업그레이드 및 다운 그레이드는 도움이되지 않았습니다. 2.2 Azure SDK로 다시 전환하는 것을 고려 중입니다. 도움이 될까요? –

+0

아니요 스토리지 에뮬레이터에 문제가있는 것으로 의심됩니다. 대신 진정한 푸른 색 저장소 계정을 사용해도 되나요? –

+0

좋아요, 다른 컴퓨터에서 작동하도록했습니다. 새로 설치 2.3 Azure 및 최신 저장소 클라이언트 libs. 이 문제는 로컬 에뮬레이터 문제와 관련 있다고 가정합니다. 다시 설치하려고합니다. 어쨌든 이브 감사합니다! :) –

관련 문제