# GetNextMsg

### int GetNextMsg(ref int lMsgId)

Message Queue에 남아 있는 메시지에 대한 포인터를 얻어 옴.

{% hint style="info" %}
일반적인 상황에서 EZGemPlus의 Message는 문제없이 사용자에게 전달됩니다. 하지만 사용자가 수신한 메시지를 잘못 처리하거나 처리에 시간이 너무 걸리는 경우 Message 전달 실패 상황이 발생하여 Message가 전달되지 못하고 Message Queue에 남아 있을 수 있습니다. 이에 대비하여 해당 함수는 사용자가 원할 때 EZGemPlus의 Message Queue에 있는 Message를 가져올 수 있는 기능을 제공합니다.
{% endhint %}

Parameters

<table data-header-hidden><thead><tr><th width="221" valign="top"></th><th width="104" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Name</td><td valign="top">Type</td><td valign="top">Description</td></tr><tr><td valign="top">lMsgId</td><td valign="top">int</td><td valign="top">Msg Queue에 남아있는 메시지 중 첫 Message의 ID</td></tr></tbody></table>

```csharp
int lMsgId = 0;

// 큐에 쌓인 메시지가 없을 때까지 반복해서 가져옴
while (m_gem.GetNextMsg(ref lMsgId) >= 0)
{
    Console.WriteLine($"큐에서 메시지 획득 성공: ID = {lMsgId}");
    
    // 이후 해당 lMsgId를 사용하여 데이터 파싱 로직 수행
    ParseMessage(lMsgId); 
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getnextmsg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
