Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] The example code SyncRequestInstance in http.demo does not work fine #2457

Closed
2 tasks done
mistyzyq opened this issue Dec 4, 2022 · 4 comments
Closed
2 tasks done
Labels
bug Something isn't working Stale

Comments

@mistyzyq
Copy link

mistyzyq commented Dec 4, 2022

Search before asking

  • I had searched in the issues and found no similar issues.

Environment

Windows

EventMesh version

master

What happened

There may be missing some mcessary pareter configurations in the example, which causes the excample run failed.

In the main method of class org.apache.eventmesh.http.demo.pub.eventmeshmessage.SyncRequestInstance, the config of httpclient and producer are as below:

            EventMeshHttpClientConfig eventMeshClientConfig = EventMeshHttpClientConfig.builder()
                    .liteEventMeshAddr(eventMeshIPPort)
                    .producerGroup(ExampleConstants.DEFAULT_EVENTMESH_TEST_PRODUCER_GROUP)
                    .env("env")
                    .idc("idc")
                    .ip(IPUtils.getLocalAddress())
                    .sys("1234")
                    .pid(String.valueOf(ThreadUtils.getPID())).build();

            eventMeshHttpProducer = new EventMeshHttpProducer(eventMeshClientConfig);

            long startTime = System.currentTimeMillis();
            EventMeshMessage eventMeshMessage = EventMeshMessage.builder()
                    .bizSeqNo(RandomStringUtils.generateNum(30))
                    .content("contentStr with special protocal")
                    .topic(topic)
                    .pid(String.valueOf(ThreadUtils.getPID())).build();

When running this example, exceptions will be thrown in the eventmesh-runtime, and no response will be received here.
I have checked all the exceptions, by reading the exception report and debugging, all information indicate that:

  1. "username" and "password" in the eventMeshClientConfig can not be null or empty, but is missing here;
  2. the parameter "ttl" in eventMeshMessage is required, but is missing here.

I modified both of these codes with reference to the async sample code in AsyncPublishInstance, then it works fine.

How to reproduce

  1. clone the master branch to local
  2. start the eventmesh-runtime with the eventmesh-starter
  3. start the eventmesh-examples, run main method in SyncRequestInstance of http.demo, and no response would be received.
  4. if post request with curl, it would be blocked till timeout, with no response.

Debug logs

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@mistyzyq mistyzyq added the bug Something isn't working label Dec 4, 2022
@mistyzyq
Copy link
Author

mistyzyq commented Dec 4, 2022

The following code is modified by me with reference to the async case, and it works fine.
org.apache.eventmesh.http.demo.pub.eventmeshmessage.SyncRequestInstance#main()

            EventMeshHttpClientConfig eventMeshClientConfig = EventMeshHttpClientConfig.builder()
                    .liteEventMeshAddr(eventMeshIPPort)
                    .producerGroup(ExampleConstants.DEFAULT_EVENTMESH_TEST_PRODUCER_GROUP)
                    .env("env")
                    .idc("idc")
                    .ip(IPUtils.getLocalAddress())
                    .sys("1234")
                    .pid(String.valueOf(ThreadUtils.getPID()))
                    .userName("eventmesh")
                    .password("pass")
                    .build();

            eventMeshHttpProducer = new EventMeshHttpProducer(eventMeshClientConfig);

            long startTime = System.currentTimeMillis();
            EventMeshMessage eventMeshMessage = EventMeshMessage.builder()
                    .bizSeqNo(RandomStringUtils.generateNum(30))
                    .content("contentStr with special protocal")
                    .topic(topic)
                    .uniqueId(RandomStringUtils.generateNum(30))
                    .build()
                    .addProp(Constants.EVENTMESH_MESSAGE_CONST_TTL, String.valueOf(4 * 1000));

@mistyzyq
Copy link
Author

mistyzyq commented Dec 4, 2022

The following code is modified by me with reference to the async case, and it works fine. org.apache.eventmesh.http.demo.pub.eventmeshmessage.SyncRequestInstance#main()

            EventMeshHttpClientConfig eventMeshClientConfig = EventMeshHttpClientConfig.builder()
                    .liteEventMeshAddr(eventMeshIPPort)
                    .producerGroup(ExampleConstants.DEFAULT_EVENTMESH_TEST_PRODUCER_GROUP)
                    .env("env")
                    .idc("idc")
                    .ip(IPUtils.getLocalAddress())
                    .sys("1234")
                    .pid(String.valueOf(ThreadUtils.getPID()))
                    .userName("eventmesh")
                    .password("pass")
                    .build();

            eventMeshHttpProducer = new EventMeshHttpProducer(eventMeshClientConfig);

            long startTime = System.currentTimeMillis();
            EventMeshMessage eventMeshMessage = EventMeshMessage.builder()
                    .bizSeqNo(RandomStringUtils.generateNum(30))
                    .content("contentStr with special protocal")
                    .topic(topic)
                    .uniqueId(RandomStringUtils.generateNum(30))
                    .build()
                    .addProp(Constants.EVENTMESH_MESSAGE_CONST_TTL, String.valueOf(4 * 1000));

There is a premise here, which is to fix the problems mentioned by the bug #2444 first.

@xwm1992
Copy link
Contributor

xwm1992 commented Dec 5, 2022

has replyed under the #2444 @mistyzyq

Copy link
Contributor

It has been 90 days since the last activity on this issue. Apache EventMesh values the voices of the community. Please don't hesitate to share your latest insights on this matter at any time, as the community is more than willing to engage in discussions regarding the development and optimization directions of this feature.

If you feel that your issue has been resolved, please feel free to close it. Should you have any additional information to share, you are welcome to reopen this issue.

@github-actions github-actions bot added the Stale label Apr 22, 2024
@Pil0tXia Pil0tXia closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

3 participants