Connecting to LSports - Korean

Modified on Wed, 22 Mar 2023 at 09:55 AM

LSports를 이용한 빠른 연결- RabbitMQ

RMQ를 통하여LSports서비스를 시행하신 것은 아주 현명한 선택입니다!
몇 가지 간단한 절차를 통하여 연결을 시작할 수 있습니다.

본 설명서는, 여러분의 큰 노력 없이, 어떻게 하면 LSports의 지원팀을 통해 적절하게 문제를 해결하는지를 알려드립니다.

단계별 지시사항:
• W첫째 빠른 시행을 위하여, 본사의SDK (C#또는PHP에서 현제 사용가능)의 활용을 권고합니다, 선호하는 프로그래밍 언어에 맞는 파일을 여기서 내려받으실수 있습니다:
SDK - C#

다음은 계정정보 예시입니다:
Username: MyEmail
Password: Passw0rd1234
Package: 102030
Guide: guid-provided-by-LSports
(LSports가 발급한 계정정보를 활용하여야 합니다)

비고:다음은c#를 이용한 사례들 입니다.
S시행할 코드는 본인이 직접 선택하십시요. RMQ라이브러리를 여기서 받으셔야 합니다.
현제LSports는3.6.5.0버전을 사용합니다

  1. 다음과 같이API호출을 통하여 패키지의 활성화 여부를 확인하는 것으로 시작합니다:

InPlay Package: https://inplay.lsports.eu/api/Package/EnablePackage?username=MyEmail&password=Passw0rd1234&packageid=102030

Prematch Package: https://prematch.lsports.eu/OddService/EnablePackage?username=MyEmail&password=Passw0rd1234&guid=guid-provided-by-LSports

Response:
XML Schema:

<xs:schema>
  <xs:element name="Message">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Header">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:short" name="HttpStatusCode"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Body">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:string" name="Message"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

JSON Schema: 

{
  "type": "object",
  "properties": {
    "Header": {
      "type": "object",
      "properties": {
        "HttpStatusCode": {
          "type": "integer"
        }
      },
      "required": [
        "HttpStatusCode"
      ]
    },
    "Body": {
      "type": "object",
      "properties": {
        "Message": {
          "type": "string"
        }
      },
      "required": [
        "Message"
      ]
    }
  },
  "required": [
    "Header",
    "Body"
  ]
}

만일 패키지가 이미 활성화 되어있다면,“Value was already set”이 메시지에 포함됩니다. 다른 그 어떤 상태나 오류 메시지에 대하여는 계정정보를 재 확인하거나 저희에게 연락 주십시요.

  1. 다음과 같이 ConnectionFactory를 할당합니다:
ConnectionFactory connectionFactory = new ConnectionFactory
{
    HostName = "Described below",
    Port = 5672,
    UserName = "MyEmail",
    Password = "Passw0rd1234",
    AutomaticRecoveryEnabled = true,
    VirtualHost = "Customers", //Default value
    RequestedHeartbeat = 580,
    NetworkRecoveryInterval = TimeSpan.FromSeconds(1)
};

RMQ HostName:
InPlay: inplay-rmq.lsports.eu
PreMatch: prematch-rmq.lsports.eu

  1. 다음과 같이 연결합니다:
IConnection connection = _connectionFactory.CreateConnection();
  1. 다음과 같이 모형을 만듭니다: 
IModel model = connection.CreateModel();
  1. 서비스 품질을 설정합니다: 
    model.BasicQos(prefetchSize: 0, prefetchCount: 1000, global: false);
  1. 메시지를 소모합니다: 
    EventingBasicConsumer consumer = new EventingBasicConsumer(model);
    consumer.Received += (sender, eventArgs) =>
    {
        // Deserialize message
        // Call method to handle deserialized message
    };
  1. 메시지 소모를 시작합니다:
    (앞서 설명하였듯이 (‘_’)을 포함하여 패키지ID를)
    예를들어,만일 패키지ID가 “102030” 이라면 
    model.BasicConsume(queue: '_102030_', noAck: true, consumer: consumer)
  • 이제부터RMQ연결 결과를 볼 수 있으며, 하트비트 메시지를 받을 수 있습니다.

전체 스냅 샷 요청
RMQ를 통한 업데이트 내용은 오직 변동 사항뿐이므로, LSports에서 부터 받을 메시지를 소모하기전에 받을 데이타의 전체 스냅 샷을 요청할것을 권고합니다.
API호출을 통하여 해당되는 요청을 할수있습니다:

  • Inplay Snapshot - Provides data for all events that are currently inplay.
  • Prematch Get events - Provides data for requested event(s).

데이타-구성에 대한 더 상세한 설명을 보시려면,계속하여 설명서를 판독하십시요.

발생할 수 있는 오류 유형

비고:만일 대기중인 읽지 않거나/미인정된 메시지가10,000에 이르면,메시지가 자동적으로 제거되고 패키지가 비활성화 됩니다.

대부분의 연결 시도 실패는 부정확한 신임장 또는 비활성화 된 패키지 문제입니다.다음은 가장 흔한
오류와 원인들입니다:

“연결 실패” - Connection Factory, RMQ호스트, 가상호스트와 같은 연동 세부사항 등이 정확히 확인 하십시요.
“접촉 거부” - 패키지가 활성화 되어 있는지 확인하시고 로그인 신임장과 패키지ID가 정확히 입력되었는지 확인 하십시요.

자 이제부터,구체적으로 필요한 스포츠 데이타를 주문 하시는것만 남았습니다. 다음 링크를 따라 더 자세한 개발 문서를 읽을 수 있습니다.

당사의 연결 설명서에 대한 피드백 제공이나 또는 지원이 필요하신 분은,해당 영업 판매자에게 연락 주십시요.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article