# Public api does not work

**URL:** <https://discuss.elastic.co/t/public-api-does-not-work/245541>\
**Category:** APM\
**Tags:** java\
**Created:** [August 19, 2020, 8:04am UTC](https://discuss.elastic.co/t/public-api-does-not-work/245541 "2020-08-19T08:04:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fenggao11](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fenggao11/32/70032_2.png) [@fenggao11](https://discuss.elastic.co/u/fenggao11)\
**Post date:** [August 19, 2020, 8:04am UTC](https://discuss.elastic.co/t/public-api-does-not-work/245541/1 "2020-08-19T08:04:19Z")

</div>

```auto
transaction = ElasticApm.startTransactionWithRemoteParent(new HeaderExtractor() {
				@Override
				public String getFirstHeader(String headerName) {
					System.out.println("inv.getAttachments().get(headerName)====");
					System.out.println("inv.getAttachment(headerName)" +
					inv.getAttachment(headerName));
					return inv.getAttachments().get(headerName);
				}
			});
			scope = transaction.activate();
			try {
				String[] interfaceArr = inv.getAttachment("interface").split("\\.");
				String className1 = interfaceArr[interfaceArr.length - 1];
				String name = className1 + "#" + inv.getMethodName();
				transaction.setName(name);
				transaction.setType("dubbo");
				
			} catch (Exception e) {
				transaction.captureException(e);
			}

```

i use public api to monitor dubbo project tracer;  
i use span.injectTraceHeaders in the consumer side ,it works

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/c/1c7590502c9171bfbb426e11db181e17e228ff16.png)  
but startTransactionWithRemoteParent I add in the provider side ,it does not works , the code does not perform.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 9, 2020, 4:04am UTC](https://discuss.elastic.co/t/public-api-does-not-work/245541/2 "2020-09-09T04:04:19Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
